grep -Po
Using grep
to do substring extraction in shell scripts.
Using grep
to do substring extraction in shell scripts.
I was working on a tcsh
script that did some cool stuff. But if a
user ran that script not knowing the true impact of the script, it
could make some bad irreversible changes.
While I could simply echo a warning statement and put a sleep 10
, I
wanted the wait time to be shown live.
Shell script snippets to check if you have an executable or binary
installed in PATH
.
This post shows how to get the current directory name without the
preceeding path, using awk
or rev
+cut
or the boring basename
.