bash가 argument를 해석하지 않게하려면?
글쓴이: badboy / 작성시간: 화, 2010/03/09 - 8:43오후
shell# ls S*
S1.dat S2.dat
shell# cat test.sh
#!/bin/bash
if [ $# = 1 ]; then
echo "Argc is 1" $1
fi
for i in ${*}; do
echo $i
done
shell# ./test.sh S*
S1.dat
S2.dat
shell# ./test.sh "S*"
Argc is 1 S1.dat S2.dat
S1.dat
S2.dat
두번의 실행중 아래의 경우에 "S*"라는 결과를 얻고 싶습니다.
어찌해야하나요?
Forums:
이렇게?
$ cat ./test.sh
#!/bin/bash
if [ $# = 1 ]; then
echo "Argc is 1" "$1"
exit
fi
for i in ${*}; do
echo $i
done
$ ./test.sh S*
S1.dat
S2.dat
$ ./test.sh "S*"
Argc is 1 S*
댓글 달기