Linked Questions

346 votes
8 answers
355k views

While running a script, I want to create a temporary file in /tmp directory. After execution of that script, that will be cleaned by that script. How to do that in shell script?
Bhuvanesh's user avatar
  • 3,595
290 votes
10 answers
220k views

There are some commands which filter or act on input, and then pass it along as output, I think usually to stdout - but some commands will just take the stdin and do whatever they do with it, and ...
cwd's user avatar
  • 47.1k
170 votes
12 answers
166k views

I am using ffmpeg to get the meta info of an audio clip. But I am unable to grep it. $ ffmpeg -i 01-Daemon.mp3 |grep -i Duration FFmpeg version SVN-r15261, Copyright (c) 2000-2008 Fabrice ...
Andrew-Dufresne's user avatar
190 votes
8 answers
222k views

As a comment in I'm confused as to why "| true" in a makefile has the same effect as "|| true" user cjm wrote: Another reason to avoid | true is that if the command produced ...
Kit Sunde's user avatar
  • 4,604
116 votes
5 answers
148k views

eval and exec are both built in commands of bash(1) that execute commands. I also see exec has a few options but is that the only difference? What happens to their context?
Willian Paixao's user avatar
111 votes
4 answers
136k views

I saw this line in a script: DEVICE=`dialog --inputbox "Festplatten-Laufzeit auslesen. Gebe Sie das gewünschte Device an: " 0 70 "" 3>&1 1>&2 2>&3` What is 3>&1 1>&...
jsterr's user avatar
  • 1,381
107 votes
4 answers
151k views

It seems that normal practice would put the setting of IFS outside the while loop in order to not repeat setting it for each iteration... Is this just a habitual "monkey see, monkey do" style, as it ...
Peter.O's user avatar
  • 33.8k
95 votes
2 answers
190k views

Consider the following (slightly silly) script name 'test1.sh': #/bin/bash # sleep 10 & echo sleep pid = $! pkill sleep When I run it, I get not only the output of the echo, but bash's reporting ...
fearless_fool's user avatar
38 votes
5 answers
123k views

I wanted to know if there is any way of reading from two input files in a nested while loop one line at a time. For example, lets say I have two files FileA and FileB. FileA: [jaypal:~/Temp] cat ...
jaypal singh's user avatar
  • 1,622
58 votes
3 answers
32k views

I want to see the output of a command in the terminal as if there was no redirection. Also, stderr needs to be redirected to err.log and stdout needs to be redirected to stdout.log. It would be nice ...
balki's user avatar
  • 4,737
38 votes
4 answers
52k views

I'm trying to read a text file and do something with each line, using a bash script. So, I have a list that looks like this: server1 server2 server3 server4 I thought I could loop over this using a ...
Kenny Rasschaert's user avatar
43 votes
2 answers
62k views

I am having a very hard time understanding how does one use file descriptors in shell scripts. I know the basics such as exec 5 > /tmp/foo So fd 5 is attached to foo for writing. exec 6 < /...
Ricko M's user avatar
  • 825
11 votes
4 answers
15k views

I am working on a bash script that I would like to work for several types of VCS. I am thinking of testing if a directory is a repo for a system by running a typical info command and checking the ...
Niall Murphy's user avatar
11 votes
4 answers
1k views

When trying to redirect program output with the "some number greater than" syntax (eg foo 2> myfile), what are the possible numbers here and what do they represent? I believe 1 is /dev/stdout, 2 ...
Fermat's Little Student's user avatar
12 votes
3 answers
18k views

How can one measure individual calls to bash functions from inside the bash file. I have a program that I call using the command eclipse -b col_solve.pl -e "myPred" This call outputs some ...
ZakC's user avatar
  • 223

15 30 50 per page