提问人:Walddys E. Dorrejo Céspedes 提问时间:10/28/2019 更新时间:10/28/2019 访问量:38
如何在其他用户上更改脚本并在新用户上继续执行脚本?
How to make a script change on other user and the script continue on the new user?
问:
我正在创建一个脚本来创建一个用户,挂载一个虚拟分区(一个类似 .img 的分区),现在在代码的结构上,我需要登录到新用户并为用户进行配置,所以我正在寻找并找到了一个接近的解决方案,但有一些错误。
这是代码:
sudo -u lfs -s << "EOF"
cat > ~/.bashrc << "EOF"
set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
export MAKEFLAGS='-j 20'
EOF
我得到的错误是:
/bin/bash: line 9: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
如果我添加其他 EOF,它就像一个命令或字符串一样,取决于我如何放置它,将进入用户的 .bashrc。
所以,我想知道,我怎样才能将EOF用于EOF并关闭EOF?
谢谢。
答: 暂无答案
评论
EOF
EOF1
EOF2
<< "EOF"
<< 'EOF'
> ~/.bashrc
cp bashrc.proto ~lfs/.bashrc; chown lfs ~lfs/.bashrc
chmod
install
"EOF"
EOF