Value In Brief – by Abanoub Hanna
All You Need To Know Explained In Brief

Posts Tagged with Fish

View time taken of last command in Fish shell

Just use $CMD_DURATION to get the time taken running the last command. To make your prompt give you the elapsed time for every command you run in Terminal, add this function in your Fish config file ~/.config/fish/ function fish_prompt; echo "$CMD_DURATION "; end The prompt will be like that. I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.

How to get filename without the extension in Fish script?

We can use string split like this (string split -r -m1 . $filename)[1]. I use this method in my Fish script function. function vidfps --description "vidfps <input.mp4>" ffmpeg -i $argv -filter:v fps=fps=24 (string split -r -m1 . $argv)[1]-24fps.mp4 end The above function is located in my ~/.config/fish/ file. So I can use it to convert a video to a 24 frames-per-second video using ffmpeg. the code (string split -r -m1 .

How to get arguments in Fish script?

Here is a command with 3 arguments. myfunc one two "third arg" How to get each argument in Fish script/function. to get all arguments as one string/text, use $argv. to get first argument, use $argv[1]. to get second argument, use $argv[2]. to get the function name or the script name, use $argv[0]. to the remaining three arguments after two : myfunc one two three four five, use $argv[3..-1] as -1 is the end of arguments.