2011-10-03 12 views
5

¿Qué significa -n en if [ -n "${TEMP_FILE_LIST}" ] para este script de shell?

Respuesta

15

De help test:

-n STRING 
    STRING  True if string is not empty. 
5

pruebas -n para una cadena no de longitud cero

+0

¿Qué pasa con -z? : S –

+0

@ChinBoon, consulte http://stackoverflow.com/questions/7629201/what-is-z-in-if-z-file-list – imm

4
if [ -n "${TEMP_FILE_LIST}" ] 

pruebas si el argumento "${TEMP_FILE_LIST}" no tienen longitud cero.

También puede comprobar

if [ ! -z "${TEMP_FILE_LIST}" ] 
Cuestiones relacionadas