Is it possible to combine multiple linux commands for different users? I mean, I'm logged on root
. From root
user I would like to log in on jaworows
user and execute some command on jaworows
.
&&
seems not working, because it is executing only first command.
root@jaworows:~# su jaworows && echo "hi"
jaworows@jaworows:/root$
I would like to see "hi" when I log in on jaworows.
su jaworows
starts a new shell; the command does not complete until you exit that shell. At that point, if the shell exists with status 0, the echo "hi"
will execute.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.