![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| printing first n lines in a file without using head | dareman123 | Shell Programming and Scripting | 7 | 09-24-2008 05:48 AM |
| Howto get readline to work in shellscript (stdin) | sentinel | UNIX for Dummies Questions & Answers | 3 | 09-15-2008 08:28 PM |
| how to save to file as head rows_numbers big_file | mr_bold | UNIX for Dummies Questions & Answers | 2 | 03-12-2007 02:32 AM |
| head command wont work on MF file | alfredo123 | UNIX for Dummies Questions & Answers | 10 | 03-04-2007 10:23 AM |
| help.. I am in way over my head !!!! | oberon42 | UNIX for Dummies Questions & Answers | 3 | 04-26-2002 12:13 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
cat vs head vs readline get variable from txt file
I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying:
c=$(head -1 somefile) echo $c which outputs correctly, but them when I do ... somecommand $c it says it can't find the file, is that because it's grabbing the whole line, and how should I be doing it different, grep maybe? |
|
||||
|
Code:
#!/bin/bash c=$(head -1 toconvertfile) ffmpeg -i $c -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.tempfile ffmpeg -i $c -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.flv rm $c.tempfile ffmpeg -i $c.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $c.flv.jpg #: cat toconvertfile test1.avi #: ls test1.* test1.avi if I just use Code:
#!/bin/bash ffmpeg -i $1 -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $1.tempfile ffmpeg -i $1 -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $1.flv rm $1.tempfile ffmpeg -i $1.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $1.flv.jpg with #: ./conv.sh test1.avi it works |
|
||||
|
okay, well I got it to work, thanks for the help, the final code is this: Code:
#!/bin/bash
while [ 1 = 1 ]
do
c=$(head -1 toconvertfile)
for i in $c
do
ffmpeg -i $c -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.tempfile
ffmpeg -i $c -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.flv
ffmpeg -i $c.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $c.flv.jpg
rm $c.tempfile
cat /dev/null > toconvertfile
done
sleep 30
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|