📄 list-glob.sh
字号:
#!/bin/bash# list-glob.sh: Generating [list] in a for-loop, using "globbing"echofor file in *# ^ Bash performs filename expansion#+ on expressions that globbing recognizes.do ls -l "$file" # Lists all files in $PWD (current directory). # Recall that the wild card character "*" matches every filename, #+ however, in "globbing," it doesn't match dot-files. # If the pattern matches no file, it is expanded to itself. # To prevent this, set the nullglob option #+ (shopt -s nullglob). # Thanks, S.C.doneecho; echofor file in [jx]*do rm -f $file # Removes only files beginning with "j" or "x" in $PWD. echo "Removed file \"$file\"".doneechoexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -