diff options
| author | Teddy Wing | 2016-07-21 22:06:26 -0400 |
|---|---|---|
| committer | Teddy Wing | 2016-07-21 22:06:26 -0400 |
| commit | f4f96bd6be1bce5f4a5c3d128e1ce3e2f480595f (patch) | |
| tree | bcf46ae10148ced38b32cdaafebcfa005c0174f2 | |
| parent | e09b306850f080d3deeb8660243baa7ec0282f37 (diff) | |
| download | qcd-f4f96bd6be1bce5f4a5c3d128e1ce3e2f480595f.tar.bz2 | |
qcd: Add "change" command
Option to change the path referenced by a given shortcut. Uses `sed` to
make the replacement and write out the updated database file. Using the
`-E` flag on `sed` so that the `+` regex operator works. The `-E` flag
works on OS X, but on Linux with GNU sed, it would be the `-r` flag
instead.
| -rwxr-xr-x | qcd | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -56,6 +56,13 @@ function qcd () { fi ;; -c) + local shortcut=$2 + local path=$3 + + if shortcut_exists $shortcut; then + path=$(absolute_path $path) + sed -i.bak -E "s/^${shortcut} .+$/${shortcut} ${path//\//\/}/" $QCD_DATABASE_FILE + fi ;; -r) ;; |
