Reputation
2,327
Next tag badge:
143/400 score
25/80 answers
Badges
9 21
Newest
 Guru
Impact
~140k people reached

Apr
15
awarded  Guru
Feb
25
comment What's the difference between shell builtin and shell keyword?
@nc: you won't find it documented explicitly. The reason it works is explained in this answer. The closest you'll find is in the reference manual in the section Shell Operation‌​. You'll see that alias expansion is done very early (something I tried to emphasize in this answer), in step 2. The quote removal, parameter expansion, globbing, etc. are performed later. So to disable an alias, you can use some kind of quoting to forbid the shell from understanding a token as an alias, e.g., \ll, "ll" or 'll'.
Feb
9
revised Is there a way to create multiple directories at once with mkdir?
deleted 1 character in body
Jan
29
awarded  Nice Answer
Jan
21
awarded  Custodian
Jan
21
reviewed Approve Formatting drives for Ubuntu
Dec
2
awarded  Yearling
Oct
11
awarded  Informed
Oct
5
awarded  Excavator
Oct
5
revised How to enter every directory in current path and execute script
added 127 characters in body
Oct
4
revised How to enter every directory in current path and execute script
Fixed broken code :)
Jul
1
awarded  Good Answer
Apr
24
awarded  Good Answer
Apr
1
comment How can I split a line in 2 by words/characters? (Bash) (Regex)
This and this. The main idea is that reserved variable names are in uppercase. If you use uppercase in your own variable names, you will one day have problems if you define PATH or HOME, etc. It actually happens very often that users define the variable PATH and then wonder why their script stops working all of a sudden. Latest to date is this one: stackoverflow.com/questions/29387616/…
Apr
1
comment How can I split a line in 2 by words/characters? (Bash) (Regex)
Good practice: 1. don't use uppercase variable names. 2. To get the number of characters in a string, use: chars=${#your_string}. Since you want half plus one: chars=$((${#your_string}/2+1)). This saves a subshell and a fork to external program (and saves from pathname expansion with your unquoted echo $YOUR_STRING). 3. Use more quotes: echo "$your_string" | fold -sw "$chars". Without the quotes for $your_string, you'll get surprises if your string contains glob characters like ?, *, [...] and extglobs constructs too if extglob is set.
Apr
1
comment How can I split a line in 2 by words/characters? (Bash) (Regex)
@user264974 the characters in the ranges A-Z and a-z are not wide characters, so it'll work fine with these.
Mar
31
comment How can I split a line in 2 by words/characters? (Bash) (Regex)
echo | wc is useless here. There are important quotes missing. This doesn't really show good practice. Also, be aware that fold counts bytes and not characters. So you will definitely get 3 lines or more if there are any wide characters.
Feb
26
revised What's the difference between shell builtin and shell keyword?
deleted 1 character in body
Feb
26
answered What's the difference between shell builtin and shell keyword?
Feb
24
awarded  command-line