restricted.sh
来自「Shall高级编程」· Shell 代码 · 共 48 行
SH
48 行
#!/bin/bash# Starting the script with "#!/bin/bash -r"#+ runs entire script in restricted mode.echoecho "Changing directory."cd /usr/localecho "Now in `pwd`"echo "Coming back home."cdecho "Now in `pwd`"echo# Everything up to here in normal, unrestricted mode.set -r# set --restricted has same effect.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 # Try to list attempted file creation effort.echoexit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?