This is my shell script,which needs to execute any type of command same as terminal,
#!/bin/sh
while
echo "Reading ..."
read option
echo "Its MS : $option"
do
$option
done
But is not accepting the command which has space in their arguments. like mkdir new\\ folder .
So someone help how to arguments with space..
For me, your script works just fine. The problem you describe comes from something else: Make sure not to use Backslashes for your directories:
Replace mkdir new\\ folder
with mkdir new/folder
, that worked for me.
Make also sure not to have a space within the path to your folder: Not new /folder
, rather use new/folder
, since mkdir
tries to create two folders if you have that space, one in the directory /
, another one in your current directory.
Your code works well, but for me it fails if I try to plug in sudo commands.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.