1,620 reputation
411
bio website none
location Massachusetts
age 40
visits member for 2 years, 4 months
seen Dec 12 at 1:44

Software engineer and bash aficionado.


Dec
12
answered How do I handle special characters like a bracket in a bash script?
Nov
19
comment Is there a way using a bash script to get the location of changes made in last git commit?
What about simply using HEAD in place of $LASTCOMMIT?
Nov
19
comment Bash extended globbing
+1 An example of the proper use of @ would be @(foo|bar).txt to match foo.txt or bar.txt but not any other file.
Nov
19
comment Store stdout in variable and send command to background
The text prior to the code mentions that it is up to the user to replace [...] with something that determines when it is safe to read from file, whether it be calling wait to block until the process exits, or waiting until file has some minimum length, or something else.
Nov
18
comment syntax error near unexpected token `<'
You mean process substitution (<( echo foo )), not command substitution ($(echo foo)) (which is part of the POSIX specification).
Nov
16
comment Change case of n-th letter in a string
The bash can be shortened with foo=${str:2} and ${foo^}, which only capitalizes the first character in the string.
Nov
16
comment Is test or [ or [[ more portable both between bash shells and between other shells?
Just to note, bash and zsh have supported [[ for a very long time (bash added it in the late 90s, zsh no later than 2000, and I'd be surprised if it ever lacked support), so you are unlikely to encounter a version of either without [[. Encountering a different POSIX-compliant shell (such as dash) is far more likely.
Nov
11
answered Is there a special variable containing a case statement match
Nov
6
answered cat STDIN won't work twice in script
Nov
6
comment cat STDIN won't work twice in script
<&0 only duplicates (redundantly and idempotently) the file descriptor, not the data available on that descriptor.
Nov
3
comment splitting a CSV and keeping the header without intermediate files
$(ls *.csv) is redundant; just use for csv in *.csv.
Nov
3
comment Change prompt when starting a terminal from bash script (but don't affect all terminals)
+1 for the PROMPT_THEME suggestion.
Nov
2
answered how to use regex in alias?
Nov
2
answered how to use regex in alias?
Nov
2
answered Tmux Keyboard Shortcut
Nov
2
answered bison says invalid option --
Nov
1
comment bash if statement troubles [Error==Error]: not found
= is not a bash operator here; it is an argument to [.
Oct
31
comment Arithmetic operations with expr and variables
For that matter, expr itself is obsolete for arithmetic; use $(( ... )) instead.
Oct
30
comment Why can Shell builtins not be run with capital letters but other commands can?
51 upvotes! I should have just posted an answer, instead of a comment :)
Oct
30
comment Why can Shell builtins not be run with capital letters but other commands can?
File systems are independent of the operating system. You can use other file systems with Mac OS X, and you can (in theory) use HFS+ with other operating systems. Also, you can make HFS+ case-sensitive; the case-preserving behavior is just the default for historical reasons.