본문 바로가기
호기심_메모

chal2(1)

by 겸손, 빚진자, 늘 배우는 사람, 배운것을 실습해보는 사람 2015. 3. 19.
반응형

root@ubuntu:~# silutation=Hello

root@ubuntu:~# echo $silutation

Hello

root@ubuntu:~# cd chal2

root@ubuntu:~/chal2# vi test

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
 
myvar ="Hello shell"
 
echo $myvar
echo "$myvar"
echo '$myvar'
echo \$myvar
 
echo Enter some text
read myvar
 
echo '$myvar' now equals $myvar
exit 0
cs

root@ubuntu:~/chal2# ls

pssort.out test

root@ubuntu:~/chal2# ls

pssort.out test

root@ubuntu:~/chal2# vi test

root@ubuntu:~/chal2# ls

pssort.out test

root@ubuntu:~/chal2# chmod +x test

root@ubuntu:~/chal2# ./test

./test: 3: ./test: myvar: not found

   

   

$myvar

$myvar

Enter some text

Hello shell

$myvar now equals Hello shell

root@ubuntu:~/chal2#

root@ubuntu:~/chal2#

root@ubuntu:~/chal2#

root@ubuntu:~/chal2# echo $0

-bash

root@ubuntu:~/chal2# echo $IFS

   

root@ubuntu:~/chal2# echo $#

0

root@ubuntu:~/chal2# echo $$

1804

root@ubuntu:~/chal2# echo $*

   

root@ubuntu:~/chal2# echo $@

   

root@ubuntu:~/chal2# vi test2

root@ubuntu:~/chal2# chmod a+x test2

root@ubuntu:~/chal2# ls

pssort.out test test2

root@ubuntu:~/chal2# ./test2


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
 
silutation="Hello"
echo $silutation
echo "The program $0 is now running"
echo "The second parameter was $2"
echo "The first parameter was $1"
echo "The parameter list was $*"
echo "The user's home directory is $HOME"
 
echo "Please enter a new greeting"
read silutation
 
echo $silutation
echo "The script is now complete"
exit 0
cs


root@ubuntu:~/chal2# ./test2 foo bar baz

Hello

The program ./test2 is now running

The second parameter was bar

The first parameter was foo

The parameter list was foo bar baz

The user's home directory is /root

Please enter a new greeting

test

test

The script is now complete

root@ubuntu:~/chal2#

728x90

'호기심_메모' 카테고리의 다른 글

SOAP  (0) 2015.03.20
C 프로그램이 만들어지는 과정  (0) 2015.03.19
아키텍처 : 구간암호화  (0) 2015.03.19
Find 명령어  (0) 2015.03.11
L4/L7 스위치  (0) 2015.03.11