Questions tagged [unix-shell]
124 questions
5
votes
2 answers
Kill all currently running cron jobs
For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command to kill all processes by that user, but how can…
![](../../users/profiles/214426.webp)
I wrestled a bear once.
- 164
- 1
- 1
- 6
4
votes
2 answers
How to identify ancient KornShell version?
We had a guy retire on us, and the documentation left behind is a little on the light side. Need a little help identifying and using part an older client-server system.
The server itself is maintained by several excellent Unix admins. We are…
![](../../users/profiles/184613.webp)
JonathanDavidArndt
- 1,414
- 3
- 20
- 29
4
votes
1 answer
"Threading" in Shell Scripts
I have a situation where I need to:
Do some preamble setup in Script A
Start Scripts B, C, D and E together, so they run concurrently
When all four scripts have exited, do some cleanup in Script A
At the moment I have run flags in scripts B - D…
![](../../users/profiles/7574.webp)
Moo
- 2,225
- 19
- 23
4
votes
2 answers
How to encode the rdesktop password parameter in a shell script?
I can connect with this script from linux to a windows RDP session:
#!/bin/bash
/usr/bin/rdesktop -N -x m -u Administrator -p secret123 -d DOMAIN1 127.0.0.1:33891
(The rdp port of the remote windows server is securely tunneled to port 33891 on…
![](../../users/profiles/45819.webp)
mit
- 1,844
- 6
- 29
- 42
4
votes
2 answers
Shell scripting and regex: Which one is better to match numbers, [[:digit:]] or [0-9]?
As the title suggests, which one is better to match numbers, [[:digit:]] or [0-9]?
I'm using the bash shell
Thanks :)
![](../../users/profiles/42898.webp)
Likso
- 88
- 5
4
votes
5 answers
tcsh : path of sourced file
I am sourcing a file under tcsh. This file could be anywhere on the filesystem. How can I retrieve the path of my sourced file ?
$0 won't work : I don't execute the file, I source it.
Many thanks !
![](../../users/profiles/42424.webp)
Charles
- 263
- 1
- 3
- 10
4
votes
4 answers
Is there a way to prevent output from backgrounded tasks from covering the command line in a shell?
I would like to be able to run task(s) in the background of a shell and not have their output to stdout or stderr cover the command line at the bottom. Frequently I need to run other commands to interact with the background processes and would like…
![](../../users/profiles/37640.webp)
Chris Pick
- 201
- 1
- 4
3
votes
3 answers
sudo and sudo -i access features
What are privilege differences between sudo and sudo -i?
With sudo it's
$sudo echo "search foo.bar.baz" >> /etc/resolv.conf
bash: /etc/resolv.conf: Permission denied
...and with sudo -i
$sudo -i
#echo "search foo.bar.baz" >>…
![](../../users/profiles/3320.webp)
Alex
- 2,287
- 5
- 32
- 41
3
votes
1 answer
Editing the PATH in PASE
I am doing a some PHP development on an IBMi running ZendServer6. I have to call PHP by its full path of /usr/local/zendsvr6/bin/php-cli. Is there a dotfile I can edit in my home directory or some configuration change I could make from the…
![](../../users/profiles/9019.webp)
Justin Dearing
- 1,017
- 10
- 33
3
votes
6 answers
How to check a file exists
How do I determine that a file exists using a shell script?
I.e:
#!/bin/sh
if [ Does File Exist? ]
then
do this thing
fi
![](../../users/profiles/2968.webp)
Simon Hodgson
- 681
- 3
- 8
- 15
3
votes
2 answers
supress expansion of * in echo
I am working on a script which dynamically executes some queries on daily basis. These queries are coming from a table in the database.
Here is the sample output of the query table:
+---------------+-------------------------------+---------+
|…
![](../../users/profiles/155518.webp)
divinedragon
- 133
- 4
3
votes
2 answers
How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?
I'm trying to set up a shell script so that it runs background processes, and when I ctrl+C the shell script, it kills the children, then exits.
The best that I've managed to come up with is this. It appears that kill 0 -INT also kills the script…
![](../../users/profiles/145232.webp)
slipheed
- 131
- 1
- 2
3
votes
3 answers
grep - recognize carriage return as new line
I want to search a webserver running unix for php-files containing a specific string. Usually I use these commands to accomplish this:
find . -name "*.php" -print0 | xargs -0 grep -H -i "the string to search for"
This will find any php file…
![](../../users/profiles/78264.webp)
quano
- 131
- 1
- 3
3
votes
2 answers
How to change VGA mode after boot and login with ubuntu?
Is there a way to change the screen resolution of the console after the system has been booted? I've seen plenty on setting the vga= line in the boot and in the grub config but I'd like to be able to change it after I login instead. This would be…
![](../../users/profiles/34184.webp)
Mech
- 660
- 2
- 10
- 22
2
votes
5 answers
Search and delete lines matching a pattern along with comments in previous line if any
I have a requirement to write a shell script in csh to search and delete lines matching a pattern along with comments in previous line if any. For example if my file has the following lines
Shell script
#this is a…
Ashu