我正在尝试根据用户输入的变量创建一个目录,然后将文件保存在那里。
我认为这对我来说很简单,但是当我尝试保存时收到错误消息“没有这样的文件或目录”。当我点击“ls”时,它会列出带有“?”的目录。在它之后。
我正在 Mac 终端上使用 .sh 脚本。
相关代码:
#get user input
echo "enter the collection number"
read COLLECTION
#create the directory
mkdir "$COLLECTION"dir
#calculate a checksum and save it to the above directory
sudo openssl md5 /dev/disk1 > "$COLLECTION"dir/md5.txt
--