Tengo el siguiente script de envío de Sun Grid Engine:
#!/bin/sh
# sun grid engine cluster
# use current working directory
#$ -cwd
# merge error output into standard output stream
#$ -j yes
#$ -o generate_databases.log
# request to cpu number
#$ -pe make 4
currentdir=`/bin/pwd`
echo "current working directory: $currentdir"
Y aquí está mi salida.
/home/eamorr/sge
currentdir: Undefined variable.
Como puede ver, la variable 'currentdir' devuelve undefined.
¿Cómo arreglar esto?
El hecho de que el script genere el directorio actual (
—
Scott
/home/eamorr/sge ) sugiere que está encontrando pwd. Y, incluso si no, no debería causar este error; foo=`/no/such/command` Todavía debe asignar una cadena nula a foo o abortar el guión.
/bin/pwd¿es correcto? ¿Funciona cuando se invoca manualmente?