I am very new to the linux , i am trying to make a directories from the files which is present in the current working directory, one directory is created but another one is not creating it's throwing an error likemkdir: missing operand
for files in *.txt
do
folderName= echo $files | awk -F. '{print $1}';
mkdir $folderName;
done 3 1 Answer
If you need the output of a command as a new variable, put the command between $(). Like this:
folderName=$(echo $files|awk -F. '{print $1} ';)
To see what you're doing, add another echo command to confirm that the folder name has been correctly constructed:
echo $folderName
before you do the mkdir.