LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Whats the use of () -parentheses (https://www.linuxquestions.org/questions/linux-newbie-8/whats-the-use-of-parentheses-4175496488/)

divya_agsrdk 02-27-2014 10:26 PM

Whats the use of () -parentheses
 
Whats the use of () -parentheses
In the below ex: a=($*) what it means

Shell script to print the command line arguments in reverse order
if [ $# -eq 0 ]
then
echo -e "\nNo arguments entered\n"
else
a=($*)
echo "arguments are"
echo $*
let x=$#
echo "arguments in reverse order are : "
while [ $x -ne -1 ]
do
echo -n " ${a[$x]}"
let x=x-1
done
fi

Firerat 02-27-2014 10:36 PM

In this case you are creating a bash array named "a"

A good introduction to bash arrays
http://mywiki.wooledge.org/BashGuide/Arrays

PS
Please wrap code with bb code tags

[code]
example code box
2nd line
< actually 4 spaces here >3rd line
[/code]

Code:

example code box
2nd line
    3rd line



All times are GMT -5. The time now is 04:12 PM.