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
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
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
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:
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:
/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:
/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
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
1 Like