피시 (유닉스 셸)

피시(fish)는 상호작용과 사용성에 초점을 둔 유닉스 셸이다. 피시는 구성보다는 사용자 기능들을 기본으로 제공하도록 설계되었다. 피시는 이국적인 유닉스 셸로 간주되는데, POSIX 셸 표준을 철저히 준수하지 않기 때문이다.

문법 
# Variable assignment, set the variable 'foo' to the
# value 'bar'.  Fish doesn't use the = operator, since
# it is inherently whitespace sensitive.  Also, the set
# command easily extends to work with arrays, scoping, etc.
> set foo bar
> echo $foo
bar

# Command substitution, assign the output of the command
# 'pwd' into the variable 'wd'.  Fish doesn't use ``
# since they can't be nested and look too much like ' '.
> set wd (pwd)
> set wd $(pwd) # since version 3.4
> echo $wd
~

# Array variables. 'A' becomes an array with 5 values:
> set A 3 5 7 9 12
# Array slicing. 'B' becomes the first two elements of 'A':
> set B $A[1 2]
> echo $B
3 5
# You can index with other arrays and even command
# substitution output:
> echo $A[(seq 3)]
3 5 7
# Erase the third and fifth elements of 'A'
> set --erase A[$B]
> echo $A
3 5 9

# for-loop, convert jpegs to pngs
> for i in *.jpg
      convert $i (basename $i .jpg).png
  end
# Semicolons work like newlines:
> for i in *.jpg; convert $i (basename $i .jpg).png; end
# but the multi-line form is comfortable to use because
# fish supports multi-line history and editing.

# while-loop, read lines /etc/passwd and output the fifth
# colon-separated field from the file. This should be
# the user description.
> while read line
      set arr (echo $line|tr : \n)
      echo $arr[5]
  end < /etc/passwd

# String replacement (replacing all i by I)
> string replace -a "i" "I" "Wikipedia"
WIkIpedIa

각주

외부 링크 
 – containing documentation and downloads
fish on GitHub (active)
fish on Gitorious (obsolete)
fish on SourceForge (obsolete)
Fish-users – general discussion list for fish users
Shell Translation Dictionary - another Bash/Fish translation table

유닉스 셸
스크립트 언어
C로 작성된 자유 소프트웨어