zsh: almost all functions are scripts now (part 2)
This commit is contained in:
parent
75c3986785
commit
ec0cee28d9
14 changed files with 287 additions and 0 deletions
18
.config/shell/bin/cds
Executable file
18
.config/shell/bin/cds
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# cd search: cd to a directory, given part of its name
|
||||
# (also can take arguments for an `fd` commnd)
|
||||
# (also can cd to a file if `-t f` is passed)
|
||||
|
||||
if ! [ -z "$1" ];then
|
||||
DIR="$(fd --max-results=1 -t d $@)"
|
||||
if [ -f "$DIR" ];then
|
||||
cd "$(dirname "$DIR")" && pwd
|
||||
else
|
||||
cd "$DIR" && pwd
|
||||
fi
|
||||
else
|
||||
echo "$0: no arguments provided"
|
||||
return 1
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue