why some time $( ) and some time ${ } ??

$(ls -i $FILENAME | cut -d" " -f1 -)
##can you please explain me when i write echo " $( what ever command)" what exactly happened

also statement like

echo "Inode number is $(ls -i $FILENAME | cut -d" " -f1 -)" ??

One more

$[ $\(date \+"%V"\) % 2 ]   \#\# what this statement will do

If we want to execute this date function we can do it in other way round
like `date '+%V'` like this ...but when we write $(date...) what exactly the
significane of that convention

I am confused Please help me understanding !!

cheers! :smiley:

The $() tells the shell to fork a subshell and then execute the commands inside the (). Usually, what the shell forks and execs the command that you have given. This is useful when you have a pipeline of commands that returns value(s) that you want to use in a command in the current shell.

Thanks Blowtorch
great learning exp. finally tell me

In this line :---

$(ls -i $FILENAME | cut -d" " -f1 -)"

Can i made a assumption like , the expression inside the bracket return a single value and hopefully store the value in a temp like variable and $temp produce the final show ?

regds,
Jambesh

Not really. You should run that command without the $() in the directory where it is to be run (if $FILENAME is not an absolute path). Then check that the command is indeed returning the values that you are expecting.

You have to be very careful if you are gonna be using that inode number for doing things like deleting the file.