-
최신 글
- VSCode 사설망 원격 개발 구성 2022년 3월 3일
- 유럽 50개국 수도와 공용어 2022년 2월 15일
- 태극기의 의미를 알아보자 2022년 2월 14일
- Dev Lee의 프로그래밍 초급 강의 – 2 2022년 2월 13일
- [ICT 기본지식] Bit, Byte, IP 란? 2022년 2월 13일
최신 댓글
글 목록
- 2022년 3월 (1)
- 2022년 2월 (6)
- 2021년 8월 (1)
- 2021년 2월 (4)
- 2021년 1월 (9)
- 2020년 12월 (8)
- 2020년 11월 (7)
- 2020년 10월 (2)
- 2020년 9월 (8)
- 2020년 8월 (4)
- 2020년 6월 (1)
- 2020년 5월 (15)
- 2020년 4월 (40)
- 2020년 3월 (2)
- 2019년 7월 (2)
- 2019년 6월 (4)
- 2019년 5월 (4)
- 2019년 4월 (8)
- 2019년 3월 (18)
- 2019년 2월 (19)
- 2019년 1월 (1)
- 2018년 7월 (1)
- 2018년 6월 (55)
- 2018년 5월 (14)
- 2018년 4월 (27)
- 2018년 3월 (13)
- 2017년 12월 (5)
- 2017년 11월 (21)
- 2017년 10월 (2)
- 2017년 9월 (1)
- 2016년 12월 (2)
- 2016년 10월 (1)
- 2016년 9월 (3)
- 2016년 8월 (2)
- 2016년 7월 (1)
- 2016년 5월 (2)
- 2016년 4월 (2)
- 2016년 3월 (9)
- 2016년 2월 (10)
- 2016년 1월 (6)
- 2015년 12월 (8)
- 2015년 11월 (5)
- 2015년 10월 (2)
- 2015년 9월 (33)
카테고리 보관물: bash
[bash] 반올림 하기
bash shell 에서 소수점 반올림 하는 방법을 소개합니다. 아주 간단하기 때문에, 아래 예시만 보면 해결이 되실 겁니다. 짧은 포스팅을 마치며, 이글이 누군가에게 도움이 되기를 바랍니다.
카테고리: bash, ICT, Language, sh
태그: bash, bash 반올림, bash 반올림 하기, bash 반올림하기, bash 소수점 반올림, 반올림, 소수점 반올림, shell, shell 반올림, shell 반올림 하기, shell 반올림하기, shell 소수점 반올림
댓글 남기기
[bash] how to split a string with a delimiter
You can split a string with a delimiter, as the command below. string=”This is a test string” delimiter=’ ‘ IFS=$delimiter read -ra result <<< “$string” result_cnt=${#result[@]} for (( i=0; i<$result_cnt; i++ )) do echo “${result[$i]}” done Output
[bash] How to round floating point numbers
Use the round function, as the command below. #!/bin/bash round() { echo $(printf %.$2f $(echo “scale=$2;(((10^$2)*$1)+0.5)/(10^$2)” | bc)) }; test=6.6666 echo $(round $test 0) # output : 7 echo $(round $test 1) # output : 6.7 echo $(round $test 2) … 계속 읽기
[bash] How to insert a string into a text variable at specified position
To insert a string into the variable ‘text’ at position ‘p’, refer to the command below. p=5 text=”text variable” text=”${text:0:p}a string${text:p}”