added function for fish
This commit is contained in:
parent
8979439c4d
commit
a9e4ab9e98
1 changed files with 49 additions and 2 deletions
22
README.md
22
README.md
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
[LINK_NAME] : [LINK_NAME] cannot be "last"
|
||||
|
||||
### To use add a function in .bashrc like:
|
||||
### To use add a function in shell like:
|
||||
#### Bash
|
||||
```bash
|
||||
function goto() {
|
||||
if [[ "$#" -eq 1 ]] && [[ "$1" != -* ]]; then
|
||||
|
|
@ -34,5 +35,24 @@ function goto() {
|
|||
fi
|
||||
}
|
||||
```
|
||||
#### Fish
|
||||
```fish
|
||||
function goto
|
||||
if test (count $argv) -eq 1
|
||||
if not string match -rq -- '^-' "$argv[1]"
|
||||
set out (/home/ud/Scripts/goto $argv[1] 2>&1 )
|
||||
if test $status -eq 0
|
||||
cd "$out"
|
||||
else
|
||||
echo $out
|
||||
end
|
||||
else
|
||||
/home/ud/Scripts/goto $argv
|
||||
end
|
||||
else
|
||||
/home/ud/Scripts/goto $argv
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue