# MSSQL or SQL SERVER or SQLSERVER?

**URL:** <https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233>\
**Category:** Shell Programming and Scripting\
**Created:** [September 13, 2013, 11:06am UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233 "2013-09-13T11:06:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsflash80](https://community.unix.com/letter_avatar/gsflash80/32/5_5575768a8748004e209b776fc1b2916d.png) [@gsflash80](https://community.unix.com/u/gsflash80)\
**Post date:** [September 13, 2013, 11:06am UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233/1 "2013-09-13T11:06:43Z")

</div>

hi, i'll want to try on the parameter with three possibility because mine colleagues usally to work on the other name folders.

for example:

MSSQL  
SQL SERVER  
SQLSERVER

```nohighlight
case $q in
    a) echo -ne "Work database: "
        echo ""
        echo " 1) ORACLE"
        echo ""
        echo " 2) MSSQL"
        echo ""
        echo -ne " What? []\b\b"
        read -n 1 db_tip

        case $db_tip in

        1)
        db_tip="ORACLE"
        ;;

        2)
        db_tip=$(echo "MSSQL") | $(echo "SQL SERVER") | $(echo "SQLSERVER")
        ;;
        *) echo "Error, try only those number"
        esac
        echo " "

```

and when i use on script

```nohighlight
cd "$db_tipo"

```

when on the folder have MSSQL or SQL SERVER or SQLSERVER, i'll wnat to get all files \*.SQL from those folders, also when it's already only folder or two folders like MSSQL and/OR SQLSERVER and/OR SQLSERVER.  
thanks

---

<div class="post-metadata">

**Author:** ![spacebar](https://community.unix.com/user_avatar/community.unix.com/spacebar/32/1679_2.png) [@spacebar](https://community.unix.com/u/spacebar)\
**Post date:** [September 13, 2013, 10:03pm UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233/2 "2013-09-13T22:03:51Z")

</div>

Do you mean when option 2 is selected you want to copy all files with extension(\*.SQL) from folders(MSSQL, SQLSERVER, SQLSERVER) if the folder(s) exist?

---

<div class="post-metadata">

**Author:** ![gsflash80](https://community.unix.com/letter_avatar/gsflash80/32/5_5575768a8748004e209b776fc1b2916d.png) [@gsflash80](https://community.unix.com/u/gsflash80)\
**Post date:** [September 18, 2013, 11:33am UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233/3 "2013-09-18T11:33:46Z")

</div>

> [@spacebar](#):
>
> Do you mean when option 2 is selected you want to copy all files with extension(\*.SQL) from folders(MSSQL, SQLSERVER, SQLSERVER) if the folder(s) exist?

Yes 😉

---------- Post updated 18-09-13 at 12:07 PM ---------- Previous update was 17-09-13 at 02:33 PM ----------

None reply?

---------- Post updated at 05:33 PM ---------- Previous update was at 12:07 PM ----------

i have resolved on this mode:

```plaintext
DIRLOC=$(pwd)
DIRNAMES="SQLSERVER SQL MSSQL"
for DIRNAME in ${DIRNAMES}; do if [-d "${DIRLOC}"/"${DIRNAME}"]; then echo "${DIRLOC}"/"${DIRNAME}" exist; else echo "${DIRLOC}"/"${DIRNAME}" not exist; fi; done

```

and result:

```plaintext
/home/script/SQLSERVER exist
/home/script/SQL not exist
/home/script/MSSQL not exist

```

it's ok, but when i'll want to find the folder "SQL SERVER" and i tried with

`DIRNAMES="SQLSERVER SQL MSSQL ""SQL SERVER"""`

and results:

```plaintext
/home/script/SQLSERVER exist
/home/script/SQL not exist
/home/script/MSSQL not exist
/home/script/SQL not exist
/home/script/SERVER not exist

```

it's not worked for the folder with space, what is another mode?  
Thanks

---

<div class="post-metadata">

**Author:** ![ahamed101](https://community.unix.com/user_avatar/community.unix.com/ahamed101/32/1118_2.png) [@ahamed101](https://community.unix.com/u/ahamed101)\
**Post date:** [September 18, 2013, 11:55am UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233/4 "2013-09-18T11:55:23Z")

</div>

```nohighlight
dirs=(MSSQL SQL\ SERVER SQLSERVER ABC)
for((i=0;i<${#dirs[@]};i++))
do
  printf "${dirs[$i]} "; 
  test -d "${dirs[$i]}" && echo exists || echo "does not exist"
done

```

--ahamed

---

<div class="post-metadata">

**Author:** ![gsflash80](https://community.unix.com/letter_avatar/gsflash80/32/5_5575768a8748004e209b776fc1b2916d.png) [@gsflash80](https://community.unix.com/u/gsflash80)\
**Post date:** [September 18, 2013, 12:03pm UTC](https://community.unix.com/t/mssql-or-sql-server-or-sqlserver/334233/5 "2013-09-18T12:03:03Z")

</div>

> [@ahamed101](#):
>
> ```plaintext
> dirs=(MSSQL SQL\ SERVER SQLSERVER ABC)
> for((i=0;i<${#dirs[@]};i++))
> do
> printf "${dirs[$i]} "; 
> test -d "${dirs[$i]}" && echo exists || echo "does not exist"
> done
> 
> ```
> 
> --ahamed

thanks much :b::b:
