DEV Community

Discussion on: Two Bash scripts I cannot live without when working with Git

Collapse
 
euphnutz profile image
Brian Cuerdon

You should change your test statement to:

if [[ -n "$TO_REMOVE" ]]; then

This will remove the dependency on bc.

Collapse
 
erykpiast profile image
Eryk Napierała

That's smart! So instead of counting lines, I'm checking if the string is not empty, right?

Collapse
 
euphnutz profile image
Brian Cuerdon

Yep! Using the bash string comparison operator -n: tldp.org/LDP/abs/html/comparison-o...

Thread Thread
 
erykpiast profile image
Eryk Napierała

Wonderful! Thank you for the suggestion :)