Skip to content

Instantly share code, notes, and snippets.

@jeamland
Last active October 17, 2018 04:39
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 jeamland/a1cb517203077815bd84fde919c6b411 to your computer and use it in GitHub Desktop.
Save jeamland/a1cb517203077815bd84fde919c6b411 to your computer and use it in GitHub Desktop.
fish vs bash
# Necessary establishing information...
fish$ fish --version
fish, version 2.7.1
# Let's create a file that contains newlines.
fish$ cat > testfile.txt
foo
bar
# fish uses (command) to put stuff on the command line
fish$ echo (cat testfile.txt)
foo bar
# Hmm. We've lost the newlines. I wonder what bash does.
fish$ bash
bash$ bash --version
$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
bash$ echo $(cat testfile.txt)
foo bar
# Well that's the same, what about with quotes?
bash$ echo "$(cat testfile.txt)"
foo
bar
# Ah ha! Let's try that in fish!
bash$ exit
fish$ echo "(cat testfile.txt)"
(cat testfile.txt)
# Darn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment