Skip to content

Instantly share code, notes, and snippets.

@docPhil99
Last active September 22, 2022 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save docPhil99/c47894d7a76772af9b05fe658489a811 to your computer and use it in GitHub Desktop.
Save docPhil99/c47894d7a76772af9b05fe658489a811 to your computer and use it in GitHub Desktop.
Fish shell tips - a work in progress

Batch convert HEIC using a fish shell

for p in *.HEIC;
  heif-convert $p (path change-extension jpg $p)
end

Note the path command required fish 3.5

Command subsitution

set var1 (pwd)
echo $var1

A command substitution can have a dollar sign before the opening parenthesis like outercommand $(innercommand). This variant is also allowed inside double quotes. When using double quotes, the command output is not split up by lines.

For example,

second line" > myfile
set myfile "$(cat myfile)"
printf $myfile

prints

first line
second line⏎

without the double quotes this is first line second line

Between single quotes, fish performs no expansions. Between double quotes, fish only performs variable expansion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment