피시 (유닉스 셸)

위키백과, 우리 모두의 백과사전.

피시
Fish
원저자Axel Liljencrantz
개발자Fish-shell 개발자들[1]
발표일2005년 2월 13일(19년 전)(2005-02-13)
안정화 버전
3.7.1[2] 위키데이터에서 편집하기 / 2024년 3월 19일(34일 전)(2024년 3월 19일)
저장소
프로그래밍 언어C++
운영 체제유닉스 계열
종류유닉스 셸
라이선스GPL-2.0-only[3]
웹사이트fishshell.com

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

문법[편집]

# 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

각주[편집]

  1. “fish shell team members”. GitHub.com. 2021년 7월 28일에 확인함. 
  2. “Release 3.7.1”. 2024년 3월 19일. 2024년 3월 22일에 확인함. 
  3. fishshell.com License for fish
  4. Liljencrantz, Axel (2005년 5월 17일). “Fish - A user-friendly shell”. Linux Weekly News. 2010년 3월 24일에 확인함. 
  5. “Fish docs: design”. 2021년 4월 9일에 확인함. 

외부 링크[편집]