Skip to main content

Timeline for Checking if line in file exists

Current License: CC BY-SA 3.0

4 events
when toggle format what by license comment
Jun 20, 2014 at 13:41 vote accept albru123
Jun 20, 2014 at 12:41 comment added Stéphane Chazelas That checks if the variable is empty. That condition is true for unset variables but also for variables that are set to the empty string. [[ -z "${cores+set}" ]] would be for checking specifically if the variable is unset (that also works for array or hash variables with bash or zsh, but not ksh93 (though with bash if an array or hash is set but has no member, it's considered unset (a WA is to use declare -p array > /dev/null 2>&1))).
Jun 20, 2014 at 12:33 history edited harish.venkat CC BY-SA 3.0
added 305 characters in body
Jun 20, 2014 at 12:19 history answered harish.venkat CC BY-SA 3.0