12,682 reputation
22542
bio website
location
age
visits member for 3 years, 9 months
seen 8 hours ago

Oct
21
comment Deleting input back to the last forward slash
Good answer. More commonly you'd enclose the whole setting in single quotes with the bind command; bind '"\ew": backward-kill-word', but that's nitpicking. And it may be worth mentioning that you can also put "\ew": backward-kill-word in ~/.inputrc, in which case other commands that use readline will also have that binding, e.g. if you enable readline in the python interactive shell, that binding will also apply there.
Oct
19
comment How to move files based on first word in file name?
Note that it fails if the filename contains " quotes. This is because you inject data into code, which is something you generally want to avoid (think Bobby Tables). Even worse, it may run arbitrary code by specially crafted filenames: e.g. if you run touch 'dog ".`mktemp`.".jpg' before that find command, mktemp will actually be run.
Oct
19
answered How to move files based on first word in file name?
Oct
17
revised Reasons why crontab does not work
rolled back to a previous revision
Oct
17
comment Difference between echo -e “<string>” and echo $“<string>”
Also worth noting that both Chet and POSIX recommend using printf rather than echo
Oct
17
comment gibberish command not found on bash terminal startup
I usually recommend PS4='+ $BASH_SOURCE:$LINENO:' bash -xlic "" for debugging the initialization files.
Oct
16
comment Move Files To Directories Based on File Name
Note that [A-M] will typically be equivalent to something like [AaBbCc...LlM] in most locales, depending on how the given language sorts things lexicographically. May also include non-ascii letters the current language happens to sort in between there. In this case, this is probably ok, but may be worth noting. To have it mean [ABCDEFGHIJKLM], set LC_COLLATE=C (or since bash 4.3 there's also: shopt -s globasciiranges). Don't you just love locales? :)
Oct
15
comment Reasons why crontab does not work
@ulidtko ... or when the cronjob suddenly stopped working because you installed package foo, which happened to install a command in /usr/bin with the same name as one you use from someApp, but doing something completely different, of course. That could have disastrous effects. You obviously have to trust that the commands in /opt/someApp/bin are not malicious. If there are malicious commands in there, the system administrators have done a poor job.
Oct
15
comment Reasons why crontab does not work
@ulidtko, I'd say no, you'd typically want the executables in /opt/someApp/bin to take precedence over commands that happen to have the same name in other directories. The order was intentional.
Oct
2
revised How can I decode a base64 string from the command line?
Include example of a longer string
Oct
2
comment How can I decode a base64 string from the command line?
@morloch or just avoid removing the newlines from the base64 encoded data, and it works as expected...
Sep
30
awarded  Explainer
Sep
11
comment How to see the command attached to a bash alias?
bash has no which command.
Sep
7
awarded  command-line
Sep
7
awarded  Guru
Sep
3
comment How to see the command attached to a bash alias?
@user251046 keep using type until you hit something other than an alias ...
Aug
16
comment How to determine whether a process is running or not and make use it to make a conditional shell script?
@jp093121 The EXIT trap is triggered when the script exits. Whether it exits because it reaches end of script, an exit command, or receives a signal (that can be handled), the rm command is run. So as long as it ends after the trap has been set, the lock should be gone.
Aug
12
awarded  Nice Answer
Aug
10
awarded  Nice Answer
Jul
26
comment Ubuntu 14.04 not running Bash scripts in /etc/cron.daily
Right. Commands shouldn't have extensions anyway, so that's a good thing.