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 10925

Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).

2
votes
Bash has built-in pattern matching with the == comparison operator when using the [[ ]] form, so you could do something like this to avoid calling grep altogether: if [[ $HAYSTACK == *${NEEDLE}* ]] ; …
answered Dec 21 '16 by James Sneeringer
1
vote
You are unlikely to find such a tool, as csh is widely viewed to be inappropriate for shell scripting. If you have any Bourne-derived shells available to you (e.g. sh, ksh, mksh, ash, dash, bash), you …
answered Aug 24 '15 by James Sneeringer
1
vote
GNU Awk is often installed as gawk, with awk as a symlink to it on systems where GNU is the default. I would guess this is the case on BSD and OS X systems, since they already have their own awk. if …
answered Oct 16 '15 by James Sneeringer
7
votes
Just remove the inner quoted double-quotes: fpath="${HOME}/New Folder/foobar.txt" Since the complete variable contents are contained in double-quotes, you don't need to do it a second time. The rea …
answered Mar 8 '17 by James Sneeringer
12
votes
Bash will run in POSIX-compliant mode if the POSIXLY_CORRECT environment variable is set. From the manpage: POSIXLY_CORRECT If this variable is in the environment when bash starts, t …
answered Sep 21 '12 by James Sneeringer
9
votes
Change --directory to -d. The former is a GNU-ism, but GNU mktemp from coreutils also supports -d. The mktemp in OS X is the same as from BSD, so -d should be pretty portable among systems that actual …
answered Jan 26 '12 by James Sneeringer
2
votes
You can use OpenSSL to generate the random password (16 characters, in this case): # 1000 bytes should be enough to give us 16 alphanumeric ones p=$(openssl rand 1000 | strings | grep -io [[:alnum:]] …
answered Dec 6 '12 by James Sneeringer