I have 5 shell files in a specific locations on my ubuntu system. I have two users on this system userA
which is the main user and userB
. Currently I have to manually open a terminal using user userA
and then run a sequence of some terminal commands which includes running 4 of the 5 shell files I have, then I open another terminal and switch to userB
and then run a sequence of some commands and 1 shell file. What I want to do is to have two shell files on the desktop (e.g. userA.sh
and userB.sh
) and when I double click on the userA.sh
it will open a terminal using userA
and then run the sequence of commands which includes running four shell files, and when I double click on the userB.sh
it will open another terminal and switch to userB
and then run a sequence of some commands which includes one shell script.
EDIT:
This is what I did according to Muru suggestion:
I created a scriptA.sh
on the desktop and make it executable then this was it content:
#!/bin/bash
sudo -u userA bash -c 'PACKAGE_PATH=/home/userA/package1; cd /home/userA/scripts'
but after double clicking it and choosing to run with terminal
option, the terminal opens for a second and then closes itself. I don't know why this is happening, so I'd appreciate if anyone could please advise why this is happening and how to overcome it.
su
command