안녕하세요.
스크립트 작성 중인데요
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/
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
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/
댓글 달기