안녕하세요.
스크립트 작성 중인데요
ls했을 때 a.sh b.sh c.sh
.sh제외하고 a b c 출력할 수 있나요.
간단히 될 듯 한데 잘 안 되네요..
감사합니다.
LIST=$(ls) for entry in $LIST do echo ${entry%%.sh} done
---- ${string%%pattern} longest matching pattern을 string의 뒤에서 부터 찾아서 제거합니다.
${string%pattern} shortest matching pattern을 string의 뒤에서 부터 찾아서 제거합니다.
##, # 은 앞에서 부터..
$ /bin/ls | sed 'e/\.sh$//'
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html Korean Ver: http://cinsk.github.io/cfaqs/
LIST=$(ls) for entry in
LIST=$(ls)
for entry in $LIST
do
echo ${entry%%.sh}
done
----
${string%%pattern}
longest matching pattern을 string의 뒤에서 부터 찾아서 제거합니다.
${string%pattern}
shortest matching pattern을 string의 뒤에서 부터 찾아서 제거합니다.
##, # 은 앞에서 부터..
$ /bin/ls | sed
--
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://www.cinsk.org/cfaqs/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://cinsk.github.io/cfaqs/