jueves, 25 de junio de 2015

SHELL Script

1.- If
The issue addressed is when is required to test if file is empty. But before that is needed to check if the file exist, I tried this and it worked.

[ -f /etc/hosts ] && echo "Found" || echo "Not found"

2.- Variable empty
Check if a variable is empty before to check if the file path in the variable exist.

if [ -z "$var" ]
then
echo "\$var is empty"
else
echo "\$var is NOT empty"
fi


3.- Convert from ogg to mp3
ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3
And also the script. 
 
 
4. Process a list of files
In this link is showed how
for i in *.txt

5. Execute scripts remotely using a local script
ssh pepito@bigserver.com.pe < ./src/main/resouces/shell_scripts/unix_code.sh
check this link for more details


No hay comentarios:

Publicar un comentario