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 135601

The shell is Unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …). For shell scripts with errors, please check them in http://shellcheck.net before posting here.

1
vote
I will suppose you have no "\n" in filenames and your shell is bash : find /path -type f -print | split -l 5400 - filenames. for f in filenames.* do tar cvzf tarfile-${f#filenames.}.tar.gz -T $f …
answered Nov 25 '16 by Vouze
0
votes
I cannot reproduce your problem. "&;" might be the error. nohup ./script.sh & tail -f nohup.out But if tail is too fast to start : nohup ./script.sh & sleep 1 ; tail -f nohup.out
answered Feb 13 '17 by Vouze
1
vote
With bash you can also do it like this : read a < <(echo hello) echo "$a" Or like this : shopt -s lastpipe echo hello | read a shopt -u lastpipe echo "$a" But you still have to launch a sub-proc …
answered Jan 3 '17 by Vouze
5
votes
# oops ! There is another difference, when we use shell functions instead of binaries. In bash, functions that are part of a pipeline are executed in sub-shells (except for the last pipeline component … if the lastpipe option is enabled and bash is non-interactive), so the change of variables have no effects in the parent shell: $ a=a $ b=b $ x(){ a=x;} $ y(){ b=y;} $ echo $a $b a b $ x | y …
answered Jan 16 '17 by Vouze
0
votes
Your shell script is executed by another shell which is a sub process. There is no direct way to pass a variable from the child process to its parent. One method could be to execute the script with … your current shell with the dot (".") operator, but any call to exit will stop your current shell and you will inherit all the variables of your script : . ./create_backup.sh && ln -s $BACKUP_FILE …
answered Dec 22 '16 by Vouze
1
vote
You could put the result in a file and then read it back from that file... tmpDir=/tmp/$$ rm -rf "$tmpDir" mkdir "$tmpDir" echo cmd1 > "$tmpDir"/cmd1_stdout 2> "$tmpDir"/cmd1_stderr echo $? > "$tmpD …
answered Jan 3 '17 by Vouze