我正在做一些练习练习。
编写一个脚本,该脚本将给出一个月份数字作为参数,并将该数字转换为月份名称。结果将打印到标准输出。
我做了一个解决方案:
# Test for number of argument
if [ "$#" -eq 0 ] ;
then
echo -e "No argument."
echo -e "Write a number between 1 and 12."
exit 1
elif [ "$#" -gt 1 ] ;
then
echo -e "More than 1 argument."
echo -e "Write a number between 1 and 12."
exit 1
else
numb=$1
case "$numb" in
1) echo "Month: January";;
2) echo "Month: February";;
3) echo "Month: March";;
4) echo "Month: April";;
5) echo …
Run Code Online (Sandbox Code Playgroud) 我正在做一个 FileCreator 脚本:
#!/bin/bash
echo "Welcome to the file creator! Please type the directory name:"
read dirName
mkdir $dirName
#Now I want to change directory to that new $dirName that will be run from Terminal.
Run Code Online (Sandbox Code Playgroud)
我现在的问题是,如何更改dirName
终端上可见的这个新目录的路径。所以,最后,路径应该是:/home/my_user_name/SCRIPTS/dirName
当我运行这个脚本时......
拜托,只是一个建议?:)
Linux用户!我遇到了一个问题:我在 directory 中有所有 pdf 文件Downloads
,但我希望它复制 subfolder 中的所有文件\Download\BOOKS\
。我将如何使用for
循环复制所有文件?
for files in ...