λ‘œμΌ“πŸΎ
article thumbnail

μ‚¬μš©μž μ •μ˜ν•¨μˆ˜

 

#!/bin/sh

myFunction(){
        echo "ν•¨μˆ˜ μ•ˆμœΌλ‘œ λ“€μ–΄μ™”μŒ"
        return
}

echo "ν”„λ‘œκ·Έλž¨μ„ μ‹œμž‘ν•©λ‹ˆλ‹€."
myFunction
echo "ν”„λ‘œκ·Έλž¨μ„ μ’…λ£Œν•©λ‹ˆλ‹€."
exit 0

 

ν•¨μˆ˜μ˜ νŒŒλΌλ―Έν„° μ‚¬μš©

 

#!/bin/sh

sumFunction(){
        echo "$1 $2 개의 합은 `expr $1 + $2` μž…λ‹ˆλ‹€"
}

echo "νŒŒλΌλ―Έν„°λŠ” $1 와 $2 μž…λ‹ˆλ‹€"
sumFunction $1 $2
#!/bin/sh

myFunction(){
  result=`expr $1 + $2`
  return "$result"
}

temp=$(myFunction 1 2)
echo $?
                   

export

 

μ™ΈλΆ€ λ³€μˆ˜λ‘œ μ„ μ–Έν•©λ‹ˆλ‹€. 즉, μ„ μ–Έν•œ λ³€μˆ˜λ₯Ό λ‹€λ₯Έ ν”„λ‘œκ·Έλž¨μ—μ„œλ„ μ‚¬μš©ν•  수 있게 ν•©λ‹ˆλ‹€.

#!/bin/sh
echo $var1
echo $var2
exit 0
#!/bin/sh
var1="μ§€μ—­λ³€μˆ˜"
export var2="μ™ΈλΆ€ λ³€μˆ˜"
sh exp1.sh
exit 0

 

setκ³Ό $(λͺ…λ Ή)

 

#!/bin/sh

echo "였늘 λ‚ μ§œλŠ” $(date) μž…λ‹ˆλ‹€."#였늘 λ‚ μ§œλŠ” 2021. 03. 09. (ν™”) 16:53:40 KST μž…λ‹ˆλ‹€.
set $(date)
echo "μ˜€λŠ˜μ€ $2μ›” $3일 $4μš”μΌμž…λ‹ˆλ‹€"#μ˜€λŠ˜μ€ 03.μ›” 09.일 (ν™”)μš”μΌμž…λ‹ˆλ‹€
exit 0
profile on loading

Loading...