bash나 ksh이나 변수명의 시작은 모두 $ 로 알고 있습니다.만. 잘못알고 있는 걸지도 모르겠지만요.
그리고 $! 에는 마지막 명령의 리턴값이 담기는 걸로 알고 있습니다. 마지막 명령이 정상적으로 실행되었다면 0 이 담기고 그외에는 다른 값이 들어가지요.
암튼 !$ 변수는 모르겠네요;
궁금해서 bash man page 를 봤습니다.
변수라기 보다는 history expansion character 로군요. 재미있는게 좀 있네요
Word Designators
Word designators are used to select desired words from the event. A : separates the event
specification from the word designator. It may be omitted if the word designator begins
with a ^, $, *, -, or %. Words are numbered from the beginning of the line, with the first
word being denoted by 0 (zero). Words are inserted into the current line separated by sin-
gle spaces.
0 (zero)
The zeroth word. For the shell, this is the command word.
n The nth word.
^ The first argument. That is, word 1.
$ The last argument.
% The word matched by the most recent `?string?' search.
x-y A range of words; `-y' abbreviates `0-y'.
* All of the words but the zeroth. This is a synonym for `1-$'. It is not an error to
use * if there is just one word in the event; the empty string is returned in that
case.
x* Abbreviates x-$.
x- Abbreviates x-$ like x*, but omits the last word.
If a word designator is supplied without an event specification, the previous command is
used as the event.
음음 이상한데요..
bash나 ksh이나 변수명의 시작은 모두 $ 로 알고 있습니다.만. 잘못알고 있는 걸지도 모르겠지만요.
그리고 $! 에는 마지막 명령의 리턴값이 담기는 걸로 알고 있습니다. 마지막 명령이 정상적으로 실행되었다면 0 이 담기고 그외에는 다른 값이 들어가지요.
암튼 !$ 변수는 모르겠네요;
history expansion
궁금해서 bash man page 를 봤습니다.
변수라기 보다는 history expansion character 로군요. 재미있는게 좀 있네요
댓글 달기