added function for fish

This commit is contained in:
UnrealDragon 2025-09-13 22:53:13 +05:30
commit a9e4ab9e98

View file

@ -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
```