Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 19575

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.

4
votes
Your test statement does not check if the file's suffix is .c. It checks (in most cases) if $file is equal to *.c, see test(1). However, if you replaced your for statement to read for file in *.c …
answered Nov 4 '15 by Bananguin
1
vote
If I was to write such a thing I would TODAY=`date --iso` CONFIGS="/etc/inittab /etc/default/cron /etc/default/login ..." ssh -q $HOST 'for cfg in '${CONFIGS}'; do digest -v -a md5 ${cfg}; done' |\ …
answered Mar 25 '14 by Bananguin
1
vote
1answer
using Bash, so I was thinking along the lines of using fc and aliases, but I cannot make this work at all. I think fc's patterns are restricted to mere string replacement and cannot cope with complex …
asked Sep 5 '16 by Bananguin
1
vote
If you really want to do that ("expect the users of my script to need to specify the address they want to use"), you can always ask them to put their email-address into ~/.emailaddress or another loca …
answered Apr 24 '14 by Bananguin
48
votes
You can pipe it through awk and make it echo the first word echo * | head -n1 | awk '{print $1;}' or you cut the string up and select the first word: echo * | head -n1 | cut -d " " -f1 or you p …
answered Feb 24 '13 by Bananguin
2
votes
scripts hits an exit it will terminate your shell. break on the other hand merely leaves the current loop structure, the while loop in your case. From the bash manual: break break [n] Exit …
answered Dec 8 '15 by Bananguin
2
votes
/passwd and /etc/shadow. For example if your root-username was admin, the corresponding line in /etc/passwd might look like this: admin:x:0:0:My personalized root account:/home/mynormaluser:/bin/bash
answered Aug 16 '13 by Bananguin
2
votes
2answers
I just solved a problem with my Makefile(s). Make trips over every <<< with the error message /bin/sh: 1: Syntax error: redirection unexpected And I would like to know why. (I am using Bash as … . When I copy paste my make output to a normal bash prompt, every command works just as expected, even with the <<<. I am fairly certain that my problem is, that using the <<< operator, i.e. here …
asked May 22 '18 by Bananguin
7
votes
process inherits that environment and then bash sources ~/.bashrc again, which may have unwanted side effects. However, it is totally acceptible to have a ~/.myenvironmentvariables, which contains stricly …
answered Nov 26 '14 by Bananguin
3
votes
I just wondered the same thing. I have my own approach, but I'm looking for alternatives. I write bash wrappers around program calls and pipe their output though sed. What I like about sed is …
answered Apr 9 '13 by Bananguin
9
votes
It is explained in the article you linked ... you can create environment variables with specially-crafted values before calling the bash shell. These variables can contain code, which gets … executed as soon as the shell is invoked. Which means the bash that is called with -c "echo this is a test" executes the the code in the single quotes when it is invoked. Bash has functions …
answered Sep 24 '14 by Bananguin
0
votes
This is an odd question without providing more context ... There is a tool called OfflineIMAP which will sync a local Maildir hierarchy with a server. If you use this without any filters it will creat …
answered Jan 24 '14 by Bananguin
7
votes
3answers
I'm used to bash's builtin read function in while loops, e.g.: echo "0 1 1 1 1 2 2 3" |\ while read A B; do echo $A + $B | bc; done I've been working on some make project, and …
asked Oct 15 '14 by Bananguin
1
vote
As always, there is probably a million ways to do this and the way I read your question your are going about your problem the wrong way, but first things first. After entering your username and passw …
answered Nov 23 '12 by Bananguin
-3
votes
. So you can become root and edit /etc/passwd, e.g. sudo vi /etc/passwd search for the line that begins with your username. It probably ends with :/bin/bash. Change /bin/bash to /usr/bin/tmux and now … directoy named .bash_login and start tmux from within that file: `echo "tmux" >~/.bash_login. This should work, but you have to try and find our yourself, b/c the bash documentation is not very exact about what file is read and executed when. …
answered Jul 20 '12 by Bananguin