Tagged Questions
3
votes
2answers
121 views
Passing a bash command-line argument containing a dot
How can a command-line argument containing a dot (.) be passed? Are there any escape sequences for capturing characters like dot?
The following invocation of a bash-script from the shell does not ...
4
votes
3answers
97 views
Does bash have a built in caching command available (sort of like mktemp or sponge)?
I'm using the amazon ec2 command line tools, and the ec2-describe-instances tool is a little painful because of the 2-5 seconds it requires to make the request and display the output.
I'm looking ...
4
votes
1answer
57 views
Order of redirections
I don't quite understand how the computer reads this command.
cat file1 file2 1> file.txt 2>&1
If I understand, 2>&1 simply redirect Standard Error to Standard Output.
By that ...
0
votes
4answers
57 views
Renaming files works, but soft links point to the old names. How can I fix that?
For example, I'm renaming many files inside a tree like this:
[bash]$ for file in `find . -name "*gsf*"`; do `mv $file ${file/gsf/msf}`; done
That renames all the instances of "gsf" in file names ...
2
votes
3answers
81 views
How can I expand a relative path at the command line, with tab completion?
In bash is there any way to expand a relative path into an absolute path, perhaps with tab completion?
I ask because sometimes I will search for a file, find it, then vim it:
cd /etc
cd apache2
cd ...
0
votes
1answer
148 views
How to pkill from a script?
How can I write a script that basically just runs pkill -HUP inetd? I want to restart inetd via a script so I can schedule it to run at a particular time. I tried to write it myself, but I'm getting a ...
7
votes
4answers
203 views
What is the easiest way to execute text from tail at the command line?
Sometimes I'm working on a new (ubuntu) box and I type git and am alerted:
The program 'git' is currently not installed. You can install it by typing:
apt-get install git-core
If that happens I ...
3
votes
1answer
80 views
Home key acting strange in bash (tty and X) on long input strings
When I hit Home if my current input is short enough (say, <36 characters), it works fine. However, when I've typed a longer command and then want to go back to the beginning, it seems like it does ...
3
votes
1answer
66 views
How can I act on the results of the “locate” command?
I'm trying to find where check_dns is defined in nagios' commands.cfg file, although there are quite a few files.
I know I could run something like find / -name "command.cfg" -exec grep check_dns {} ...
2
votes
5answers
142 views
Is it possible to reference the most recently modified file in a command line argument?
I frequently download PDF files with heinous numeric file names from my browser. These automatically go into ~/Downloads. Ideally I would like to just be able to open these files with:
evince "the ...
2
votes
2answers
95 views
Shell Prompt Customization?
I have used oh_my_zsh (and tinkered with bash_it) on multiple systems and have generally been happy with it, though I hate it's auto-correction feature and generally turn it off.
My usual shell is ...
0
votes
0answers
40 views
-d shell script doesn't work [closed]
Possible Duplicate:
Change directory with -d in shell script
I am trying to give the option to the users to run the script in a different directory. However when the script changes the ...
0
votes
1answer
66 views
terminal logging doesn't complete when I close the terminal
This is the last line in my .bashrc (lines breaks inserted for readability):
STARTTIME=`date +%F-%Hh-%Mm-%Ss-%N`; \
script -q -t 2> /home/USER/logs/$STARTTIME-timing.txt \
-c 'bash --rcfile ...
17
votes
2answers
681 views
Why is bash's prompt variable called PS1?
The environment variable for the bash prompt is called PS1 (usually set in ~/.bashrc). What does PS1 stand for? Is there a PS2?
0
votes
0answers
71 views
How to create a cron which finds/kills/clears old puppet runs?
I am a new user of bash/cron, and I was given a task to create a cron which finds/kill/ and clears old puppet runs that were not successfully installed. The more help the better, but I am more or less ...