Hi Can any one help me to clear problem to assign the mkdir command output to Variable.
While execute the script I am able to create the directory with following command
#!/bin/bash
echo -n " Which Name needs to create? (y/n): "; read dom
if [ "$dom" == "y" ]; then
echo -n " Type an Domain name: " ; read domTemp
path=/home/rakesh/$domTemp
a=`mkdir -p -- "$path"`
echo "$a"
fi
By reading documents and stack issue, I know how to assign linux command to variable in shell script but the mkdir command not give expected result by printing $a and my expectation is to use the variable $a is to set the path in next command in the scrip.
/home/rakesh/foo.com
My intention is to collect the exact path of created directory to a variable. Though I can use the path to assign permission in further steps
Below solution is to make directory from variable only Assign output of mkdir command to variable
Appreciate your knowledge on this.