“list” contains list of values. The list can be a variable that contains several words separated by spaces. If list is missing in the for statement, then it takes the positional parameter that were passed into the shell.
varname is any Bash variable name.
cat for1.sh
i=1
for day in Mon Tue Wed Thu Fri
do
echo "Weekday $((i++)) : $day"
done
$ ./for1.sh
Weekday 1 : Mon
Weekday 2 : Tue
Weekday 3 : Wed
Weekday 4 : Thu
Weekday 5 : Fri
How will you go about concatenating the contents in a number of text/sql files to a single file?The account_sqls.patch file contains the following entries to a number of SQL files to be executed sequentially.
How will you combine the SQL contents in the above 4 files into one?
A. Firstly, cd to the folder where the account_sqls.patch file is, and then type the following command on a shell command line.
for varname in listdo command1 command2 ..donefor, in, do and done are keywords“list” contains list of values. The list can be a variable that contains several words separated by spaces. If l