![]() ![]() # If so, we skip importing it, unless it is just a link to a previously imported function. # Check whether the function already exists. Set -l imp_fun_file "$BASH_IMPORTS_DIR/$a_name.fish" Set -l fun_file "$FISH_FUNCTIONS_DIR/$a_name.fish" Here's a basic example: Define alias in shell alias rmi 'rm -i' Define alias in config file ( /.config/fish/config. Set -l a_name (echo $a | sed -e 's/alias \(*\)=.*/\1/') 12 Answers Sorted by: 490 Just use alias. Or test -e "$FISH_FUNCTIONS_DIR/$fun_name.fish"Īnd test (readlink -canonicalize $file_link) = (realpath $file_target)įor a in (cat $source_file | grep "^alias") # that do not contain a function wiht the same name # This also detects script files in the functions dir If & Įcho "removing converted bash alias-script: $script_name" README_FILE="$OUTPUT_DIR/$README_FILE_NAME"įor script_file in $(find "$LINKS_DIR" -maxdepth 1 -type l)Ĭonv_script_file="$OUTPUT_DIR/$(basename $script_file)" # convert_bash_aliases_to_scripts clean # removes all scripts previously converted by this script # convert_bash_aliases_to_scripts # converts all bash aliases to script files # Copyright 2018, licensed under the GPL-3.0+ # removes all scripts previously converted by this script Use like so: # converts all bash aliases to script files This allows me to use them from whatever shell i am currently executing, and it prevents potential problems with quoting. fish is a user friendly commandline shell intended mostly for interactive use. It’s not that big of a deal, but I always forget about it.I decided to do this instead of approach below, and putting the scripts into ~/bin/, which is in my PATH. This is the documentation for fish, the friendly interactive shell. Instead of $1, $2, $3 and etc, on Fish we have $argv, $argv, $argv, etc. your shell history will be saner (probably).you can copy-paste your terminal to someone else and they don’t have to know what your 348 aliases do.you can use an abbreviation similar to what you want, once it expands, edit it easily. ![]() Aliasesįish doesn’t have the concept of aliases, instead, you either wrap your command in a function (Fish has a function that does that for you, which is called alias), or use abbreviations.Ībbreviations expand once you type them, which is actually better in some ways: Things like for loops and () instead of $() took me a while to get used to, after I don’t know how many years of writing things that way, but, once I got used to, it is actually simpler. If you usually use just plain commands and pipes, it might not be an issue for you. Its common for me to script my way into the shell itself when dealing with issues, so, in the beginning, I struggled a bit. Differencesįish does not talk POSIX shell, so, some things are different. I use Fisher, because I don’t really need the whole plugin framework thing from oh-my-fish, but both of them are very good and you can choose whichever you like more to manage your plugins. Other than that, I just put a couple of files in their right folders, setup a bunch of abbreviations, and that’s it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |