I wanted to have a script that is capable of killing console windows, that are either running something or not, but at the same time, keep alive the window that executed this script. Thanks for your help Answer You can find the command name of the parent the script (bash, sh, zsh, etc.) then kill all the processes with that
Tag: shell
What’s the meaning of a ! before a command in the shell?
What is the purpose of a shell command (part of a shell script) starting with an exclamation mark? Concrete example: In foo.sh: I know that without the space the exclamation mark is used for history replacements and ! <expression> according to the man page can be used to evaluate “True if expr is false”. But in the example context that
“mkdir || echo && exit” exiting even when mkdir succeeds
mkdir $2 || echo “I can’t create directory $2” && exit 8 Hi everyone, this is my first post here, so be kind. I am making a script right now and this line troubles me. The exit 8 should happen only if the directory $2 cannot be created. After running the script and successfully creating that directory, it still exits
Non-dash related bad substitution error
I am trying to write a bash script performing to find and pull somewhere else a specific file type. So far, I came up with the following script: find ./to_compress -type f -iname “*.tar” -mindepth 1 -maxdepth 1 -exec mv {} ./compressed/${{}##*/} However the bash complains that ${{}##*/} is a bad substitution bash: ./compressed/${{}##*/}: bad substitution Some googling around suggested
Extract fields from a custom xml
Im making a script to extract fields from a XML, now i got this and i need to make it work, i was trying with 2 for and greps and i need a little help with this i got this xml withs this fields and i want a output like this for make more comparations: Answer there are many issues
Not able to execute a .csh script using jsch library – Exit 1
Im trying to use Jsch to execute a .csh script on a remote server. I am able to execute commands like cp, mv and ls. But when I try to execute a script that internally references some environment variables, the script is exiting with status 1. There is an INTERNAL_ENV_VARIABLE referenced inside script.sh that is not accessible when i run
LINUX: How to softlink specific files in all subdirectories
I want to create soft links (ln -s) to folder2 of all the files that contain *foo* in its name, and can be found in some or all the subdirectories of folder1. I’ve tried it with for, find, and find -exec ln, and a combination of them, but all I get is a broken link named *foo* or a link
Simulate permissions for non-login user
I want to perform some actions on behalf of some non-login users, such as e.g. www-data or uwsgi. My purpose is to test some permissions, check what dirs they can modify etc etc. Is there a recommended way of going about this, other than creating a shell and password for them and su ? edit: When I try to su
get user input in awk script and update it in file
I have a students.txt (RollNo, Name, IDU, CGPA), If Roll number exists prompt the user to change the IDU and CGPA and update the same in the file named “Student.txt” I made the following script: now I need help in taking user input for IDU and CGPA values and update the students.text file with that values against the record found.
Running for loop terminal commands in Jupyter
I know how to run command line in Jupyter : using ! For example, run an image file 2.jpg on Python process.py Question is, how to process all files of a folder in iteration way (idx) in Jupyter cell, something like this: Thanks PS: I tried path , did not work: Answer A possible hackish solution could be to use