티스토리 뷰

공부

[Sh] failed script timer

seunggabi 승가비 2020. 12. 16. 04:22
s=$(date +%s)
sleep 3s
e=$(date +%s)

diff=`expr ${e} - ${s}`
if [ ${diff} -lt 30 ]; then
  echo $diff
  exit 1
fi

https://qastack.kr/ubuntu/892604/meaning-of-exit-0-exit-1-and-exit-2-in-a-bash-script

 

bash 스크립트에서 종료 0, 종료 1 및 종료 2의 의미

 

qastack.kr

https://stackoverflow.com/questions/7119130/less-than-operator-in-if-statement-results-in-no-such-file-or-directory

 

Less than operator '<' in if statement results in 'No such file or directory'

Sure this is a simple one - still learning my way around sh scripts. I've got:- if [ $3 < 480 ]; then blah blah command else blah blah command2 fi $3 is a passed variable, again an integer.

stackoverflow.com

https://stackoverflow.com/questions/8385627/subtract-two-variables-in-bash

 

Subtract two variables in Bash

I have the script below to subtract the counts of files between two directories but the COUNT= expression does not work. What is the correct syntax? #!/usr/bin/env bash FIRSTV=`ls -1 | wc -l` cd ..

stackoverflow.com

 

'공부' 카테고리의 다른 글

[Spring] return NOT_FOUND 404  (0) 2020.12.23
printf("%.08f\n", 1.23);  (0) 2020.12.23
[Sh] failed script timer  (0) 2020.12.16
[Java] DAO & DTO  (0) 2020.12.13
[Hive] ORDER BY, DISTRIBUT BY SORT BY, CLUSTER BY  (0) 2020.12.13
[Python] thread  (0) 2020.12.13
댓글
댓글쓰기 폼