我有一个正在制作的脚本,但我遇到了一个问题:我想暂停执行并等待用户输入。我以为我有这个read -p -n 1 $foo命令,但系统有这个命令的问题。这是我当前的脚本:
#!/bin/sh
# Ititialization
mainmenu () {
echo "Press 1 to update your system"
echo "Press 2 to install samba"
echo "Press 3 to install vsFTPd"
echo "Press 4 to install the current version of Webmin"
echo "Press 5 to configure samba for Active Directory"
echo "Press x to exit the script"
read -n 1 -p "Input Selection:" mainmenuinput
if [ "$mainmenuinput" = "1" ]; then
updatesystem
elif [ "$mainmenuinput" = "2" ]; then …Run Code Online (Sandbox Code Playgroud) 我需要补充:
user_xattr,acl,barrier=1
Run Code Online (Sandbox Code Playgroud)
到我的 /etc/fstab 文件。有没有办法通过 via shell 脚本来做到这一点?
我只想编辑“ /”挂载。
这是我手动编辑之前的内容:
UUID=eb287d10-60a8-4a9a-9148-5f907fc7a8be / ext4 errors=remount-ro 0 1
Run Code Online (Sandbox Code Playgroud)
这是我手动添加行后的样子:
UUID=eb287d10-60a8-4a9a-9148-5f907fc7a8be / ext4 user_xattr,acl,barrier=1,errors=remount-ro 0 1
Run Code Online (Sandbox Code Playgroud)
我知道该sed -i命令在这里不起作用,因为它只会添加行...
脚本也可以在多台计算机上运行,因此它必须能够“知道”UUID 会有所不同。