Questions specific to GNU’s Bourne Again SHell, as opposed to other Bourne/POSIX shells. For questions about Unix shells in general, use the /shell tag instead.

learn more… | top users | synonyms

0
votes
0answers
6 views

How to integrate multiple Python/Perl scripts to be executed in one bash script?

I have the following Perl scripts (though this applies to Python and other scripting languages): script1.pl, script2.pl, script3.pl The way these scripts where written, users execute them with input ...
0
votes
2answers
11 views

why will Bash not add my variables together?

I am writing a shell script to calculate the averages of numbers from a file but for some reason bash is not adding my numbers together. I have tried multple ways of formatting the sum='expr $sum + $...
0
votes
0answers
6 views

logfile: if new line with specific term then action [duplicate]

I have a file that is logging new incoming mail for users of a mail system. If there is new mail, a line like this is added to the file: Mon Jan 30 23:08:21 2017: [16756] Delivered message to '...
3
votes
1answer
31 views

backticks inside brace expansion

I'm trying to list the files of httpd processes, and I tried this: ls -l /proc/{`pidof httpd | tr ' ' ','`}/ ls: cannot access /proc/{{28493,28492,28491,28490,28489,28488,28487,28486,28483}}/: No ...
0
votes
0answers
23 views

How to have a bash alias set from a random directory? [on hold]

The alias itself does not need to be local to that directory, but I want to be able to set a bash alias from anywhere. Consider this scenario: I have a development directory ~/dev, in this ...
1
vote
2answers
22 views

Bash perform variable expansion of string [duplicate]

I'm trying to have two layers of indirection, though let me know if I'm a victim of the XY problem Boiled Down Explanation of What I'd Like to Achieve > test1=\$test2 > test2="string to print" ...
0
votes
1answer
36 views

Redirect grep error output inside if conditional

I have written a script to search an .ini file for some specific word. The .ini file has one of two different names, (let's say config.ini or configuration.ini), so I have to check in both. I am ...
1
vote
0answers
26 views

bash history truncated to 2000 at new login after upgrade to ubuntu 16.04

Ubuntu 14.04 with this setup worked fine . Recently re installed my laptop with ubuntu 16.04 and every time I create a new terminal , the history get truncated to 2000 lines. I use both Tilda and ...
0
votes
1answer
38 views

iterate script execution: A call B, B call A

I have a script scriptA.sh that if a variable assume a certain value, it has to execute another script scriptB.sh that execute something and then call a scriptA.sh, that will call a scriptB.sh and so ...
1
vote
1answer
39 views

How to get exit status of a background process?

I am running two mysqlsp in a bash script. I want to start both of them simultaneously (they are running in remote servers) and put them in background, once completed proceed to next step. I want to ...
0
votes
0answers
20 views

How to understand the diffrent order of redirections means? [duplicate]

In the Bash Reference Manual: Note that the order of redirections is significant. For example, the command ls > dirlist 2>&1 directs both standard output (file descriptor 1) and ...
5
votes
1answer
273 views

Does bash have different weak quoting rules for special variables?

I don't think I fully understand the nuances of quoting in bash. I have a script, foo.sh, which simply outputs numbered arguments. #!/bin/bash i=1 while [ $i -le $# ] ; do v=$(eval "echo \$$i") ...
-2
votes
3answers
28 views

Problem using sed substitution command inside -exec option of find

Input 1: find . -maxdepth 1 -name "* *" -exec bash -c 'sed -n '1p' <(echo $1)' h {} \; Output 1: ./file with space Input 2: find . -maxdepth 1 -name "* *" -exec bash -c 'sed "1s_ _._" <(...
0
votes
2answers
28 views

How can I skip --MORE— option when I tab in cd?

I wrote in terminal: cd /some_path/ then I pressed tab and if there are a lot of directories in some_path I saw a terminal with a lot of lines and at the end there is "--MORE--" option. I should ...
0
votes
3answers
36 views

Writing and reading from file descriptor 3 and /proc

When I run the following command: exec 3<<< "TEST" I can see the following appear in /proc (note last line regarding FD3 reading deleted): # ls -al /proc/$$/fd total 0 dr-x------ 2 root ...

15 30 50 per page