SAP/메모장
shell script 에서 Text Trim 처리
그녀는애교쟁이
2023. 1. 2. 18:32
echo " lol " | xargs
echo " this string has a lot of spaces " | xargs echo -n
Produces: 'this string has a lot of spaces'
https://stackoverflow.com/questions/369758/how-to-trim-whitespace-from-a-bash-variable
How to trim whitespace from a Bash variable?
I have a shell script with this code: var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi But the conditional code always executes, because hg st always prints at least one newline cha...
stackoverflow.com
shell script 너무 어려운 것.. 텍스트에서 앞뒤 공백 트림 처리를 할 때 이렇게 처리하면 잘 동작한다.
반응형