📄 restricted.sh
字号:
#!/bin/bash# 脚本开头以"#!/bin/bash -r"来调用, #+ 会使整个脚本在受限模式下运行. echoecho "Changing directory."cd /usr/localecho "Now in `pwd`"echo "Coming back home."cdecho "Now in `pwd`"echo# 非受限的模式下,所有操作都正常. set -r# set --restricted 也具有相同的效果. echo "==> Now in restricted mode. <=="echoechoecho "Attempting directory change in restricted mode."cd ..echo "Still in `pwd`"echoechoecho "\$SHELL = $SHELL"echo "Attempting to change shell in restricted mode."SHELL="/bin/ash"echoecho "\$SHELL= $SHELL"echoechoecho "Attempting to redirect output in restricted mode."ls -l /usr/bin > bin.filesls -l bin.files # 尝试列出刚才创建的文件. echoexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -