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 11417

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.

0
votes
It depends whether you want the first line or a specific line (foo is your file). If you just want to split a specific line, use $ awk 'NR==1 { print $2; exit}' foo hi $ awk 'NR==2 { print $2; exit} …
answered Jan 27 '18 by nohillside
2
votes
I assume your input file actually only contains one file name per line and looks like this: SAE1903.barcode.in.R1.R1.fastq SAE1903.barcode.in.R1.R2.fastq SAE2000.barcode.in.R1.R1.fastq ... Your scr …
answered Oct 15 '18 by nohillside
1
vote
To avoid surprises from filenames containing spaces or worse it might be worthwhile to run everything directly from find: find /PATH/TO/SOURCE -name '*.mp4' \ -exec sh -c '[ -e "$1.t" ] …
answered Jan 1 '18 by nohillside
1
vote
~ doesn't get expanded inside "". To make it work, use export PROJ=~/"Documents/project livefeed"
answered Mar 15 '18 by nohillside
9
votes
sed seems to be rather overkill here, you can remove a trailing / directly in the Korn shell (and similar shells like bash, and all POSIX compliant shells as that Korn shell feature has been specified by POSIX for the sh utility): $ foo=/tmp/ABC/Dirs/ $ echo "${foo%/}" /tmp/ABC/Dirs …
answered Jan 6 '18 by nohillside
1
vote
You set ECount too early, at that moment the count_error file is still empty when the script executes the first time: ECount=`cat $count_error` ... grep -i "Error invoking command" $yest_* >> $error_ …
answered Jun 12 '18 by nohillside
1
vote
Basically this is a race condition if both crontab entries get executed at once. In the "no values" case the output file gets created but isn't filled yet (because ps axu | wc -l takes longer to run t …
answered Aug 10 '18 by nohillside
0
votes
Even though I think deploying util.sh to host would be the better/more stable solution, you could do something like putting this on top of main.sh #!/bin/bash U=$(mktemp) cat > "$U" . "$U" rm -f "$U …
answered Dec 24 '18 by nohillside
2
votes
From man ls: In addition, for each directory whose contents are displayed, the total number of 512-byte blocks used by the files in the directory is displayed on a line by itself, immediately befo …
answered Jul 20 '18 by nohillside
2
votes
You can use awk to search for files containing ASCII text: less $(file * | awk -F: '$2 ~ "ASCII text" {print $1}') This actually works also for directories containing several text files.
answered Mar 22 '18 by nohillside
1
vote
Day to day operations You don't need the root account enabled to perform day to day operations on macOS. And even without an enabled root account and its shell set to /usr/bin/false you are still …
answered Dec 2 '17 by nohillside
8
votes
There is nothing special here. The syntax for case is case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac In the example in the question, word is built by combining $1, / and $2. / do …
answered Dec 22 '18 by nohillside
1
vote
Two options come to mind: Use a variable: w="/my/working/directory" cd "$w" Use an alias: alias cdw='cd /my/working/directory' cdw
answered Jul 5 '18 by nohillside
1
vote
With just the script from the question I probably would do something like (ignoring other potential improvements for now) have_results=0 while [[ $have_results -eq 0 ]]; do read -p "Please inp …
answered Oct 22 '18 by nohillside
0
votes
Using a for loop might not be the best option here, better use find: cd /PATH/TO/image_script/.. find image_script -type d If you need the absolute path you can use find /PATH/TO/image_script -typ …
answered Jan 4 by nohillside

15 30 50 per page