일반변수$, $(), ${} 의 이해
쉘프로그램중 많이쓰는 변수
1)일반변수
변수=값 선언
ex) name=song
[root@system1 ~]# name=song
[root@system1 ~]# echo $name
song
ex1)
name=song 변수로 선언하였을때
[root@system1 test]# echo $name # echo $name의 결과값은 song
song
[root@system1 test]# touch $(echo $name)
# touch 명령으로 파일을 만든다. 파일명은 echo $name결과값인 song
[root@system1 test]# ls -l
합계 16
drwx------. 2 root root 16384 12월 19 14:55 lost+found
-rw-r--r--. 1 root root 0 12월 23 15:51 song # $echo($name) 의 결과값인 song이 생성됨
[root@system1 test]# test=abcdef
[root@system1 test]# echo $test #$test는 = abcdef 라는 변수다
abcdef
abcdefghijk 연달아 쓰고 싶다면
[root@system1 test]# echo ${test}ghijk
abcdefghijk