OT: setting variables
Bryan
brakeb at gmail.com
Wed Mar 11 03:37:05 CET 2009
okay, here goes...
I am making a script that will help me automate conversion of movies
to other formats. I'm trying to set a variable $CROP and I'm trying
to pull info from a text file created by mplayer to get the black
lines off of the movie. Here is the script:
----------------------------------------------------------------------------------------------
#!/bin/sh
mplayer -v -ss 00:15:00 -frames 20 -vf cropdetect dvd://1 > crop.txt
export CROP=`tail -n 11 crop.txt | grep CROP | cut -d= -f2 | cut -c 1-11`
echo $CROP
----------------------------------------------------------------------------------------------
now, the text file creates text, and I've used the "tail - grep - cut
- cut" command on the command line and was able to get the data I
needed. Also on the command line, I can export the variable (I do it
all the time with PKG_PATH). When I run the script, the crop.txt is
created, and the variable prints out $CROP, but after the script ends,
I attempt to "echo $CROP" and the variable is empty...
Is there something I'm missing? Or is there nothing wrong, and the
script (while running) knows the value of $CROP, value of $CROP is
dropped once the script terminates.
Regards,
Bryan
More information about the Openbsd-newbies
mailing list