명령문으로 cd ~account 계정안으로 들어가는데
스크립트로 돌릴땐 안됩니다.
계정 홈디렉토리가 각각일때
passwd 파일을 읽는다거나 하지 않고
위와 같은 방법으로 접근 가능하게 하려면 어찌하면 좋을까요?
cd $HOME ? cd /home/$LOGNAME ? 실행시키는 계정은 고정되어 있나요?
구여지책으로 ACCOUNT="foo" eval "cd ~$ACCOUNT"
[root@ns2 root]# pwd /root [root@ns2 root]# cat test.sh #!/bin/sh ACCOUNT=oracle eval "cd ~$ACCOUNT" pwd [root@ns2 root]# ./test.sh /home/oracle [root@ns2 root]# pwd /root [root@ns2 root]# . ./test.sh /home/oracle [root@ns2 oracle]# pwd /home/oracle
There is no spoon. Neo from the Matrix 1999.
bash 3.00.13(1)-release 에서는 스크립트에서도 되는군요..
텍스트 포맷에 대한 자세한 정보
<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]
cd $HOME ?cd /home/$LOGNAME ?실행시키는 계
cd $HOME ?
cd /home/$LOGNAME ?
실행시키는 계정은 고정되어 있나요?
구여지책으로ACCOUNT="foo"eval "cd ~$ACCOUN
구여지책으로
ACCOUNT="foo"
eval "cd ~$ACCOUNT"
There is no spoon. Neo from the Matrix 1999.
bash 3.00.13(1)-release 에서는 스크립트에서도 되는군요
bash 3.00.13(1)-release 에서는 스크립트에서도 되는군요..
댓글 달기