When you started:
`mkdir $dir`
the shell first executed a command mkdir $dirin a subshell, capturing its (standard) output, and then executed the captured line as a command. Fortunately, the solution was empty, so the second step did nothing.
When you started:
`cp /home/bhavya/workspace/UnetStack/logs/log-0.txt $dir/log.txt`
, . , , .
:
`cd $dir`
, cd , , ( Unix, DOS .bat). , cd , , .
, , .
:
dir=sample
mkdir $dir
cp /home/bhavya/workspace/UnetStack/logs/log-0.txt $dir/log.txt
cd $dir
...other activity in the new directory...
, script, script . , - . ( bash, source, ).
(, , $(...)) . :
gcc_lib_dir=$(dirname $(dirname $(which gcc)))/lib
which gcc; /usr/gcc/v4.7.1/bin/gcc; dirname /usr/gcc/v4.7.1/bin; dirname /usr/gcc/v4.7.1; /lib
gcc_lib_dir=/usr/gcc/v4.7.1/lib
, $(...) :
gcc_lib_dir=`dirname \`dirname \\\`which gcc\\\`\``/lib
, !