I would like to do the following:
I wrote the following script to do the above:
#!/bin/bash
echo "hello"
gnome-terminal -x bash -c "cd ~/automation/DVF99_Automation/Scripts;pwd;gedit sample.txt;python test.py;exec $SHELL"
echo "good bye"
The above gives me the following output:
user4@user-pc-4:~/Desktop$ ./DAT_run.sh
hello
good bye
And on the new gnome-terminal opened, I see the following message:
/home/user4/Scripts
From python script
From python script
From python script
From python script
From python script
The above means it has executed the python code and my requirements 1,2 and 4 have been met (not the 3rd). I'm unable to hold the gedit
window as a foreground process until it has been saved and closed (so that the next statement is executed only after I close the file opened in gedit
).
What could be going wrong here? I am new to shell scripting and feel like I could very well be missing something here. How can I achieve all my above requirements?
btw, you need start the gedit in background.
Example:
$ gedit sample.txt&;python test.py;exec $SHELL"
Even more better is variable subsitution.
#!/she/bang
FILE=sample.txt
gedit $(FILE)&;python test.py;exec $SHELL"
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.