리눅스 쉘 스크립트 사용법
- Linux(Ubuntu) Shell script  (쉘스크립트)


//==================
* 인자 받기 (argument)
https://tecadmin.net/pass-command-line-arguments-in-shell-script/
$* = 모든 인자
$0 = 자신 이름
$1 = 첫번째 인자


//==========
* 비교
- 변수는 따옴표로 묶어야 한다.

if [ "$1" == "up" ]; then
echo up;
elif [ "$1" == "down" ]; then
echo down;
fi



//===============
* 시간
https://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/

#! /bin/bash
set -x #명령어 보이기
echo now=$(date +%y%m%d-%H%M%S)



//=============
//참고
http://faculty.salina.k-state.edu/tim/unix_sg/shell/variables.html#


Posted by 코덴스

댓글을 달아 주세요