#!/bin/bash # to test it continuosly I keep 1copy.txt untouched # there are 4 lines in it, the first line is # ac wavSound\test.wav adpSound\test01.adp -norm cat 1copy.txt > 1.txt i=`wc -l 1.txt | awk '{print $1}'` # get line count while [[ $i -gt 0 ]] do (( i-- )) head -n1 1.txt > bat.bat # get first line into bat file sed 1d 1.txt > 2.txt # remove first line and save it new file mv 2.txt 1.txt # move it back to original file #put bat file onto Windows machine sftp adp@10.10.110.222 <## sub winUse { my $wavF =shift; my $adpC =shift; # Channel info my $adpT =shift; # Title info my $adpF = "channel$adpC-title$adpT.adp"; my $batF = "adp2.bat"; #bat file my $ordF = "cmdWin"; #windows command to exec my $wavD = "wavSound"; #wav dir my $adpD = "adpSound"; #adp dir my $winS = "10.10.110.222"; #win server my $winU = "adp"; #win user my $fh; # FileHandle my @cnvrtArray = ( "ac"," ", #adpcm_converter.exe $wavD,"\\", #wav directory on windows $wavF," ", #wav source file $adpD,"\\", #adp directory on windows $adpF," ", #adp goal file "-norm" #parameters ); open($fh,'>',$batF) or die "Can't write file '$batF' [$!]\n"; print $fh @cnvrtArray; close($fh); open($fh,'>',$ordF) or die "Can't write file '$ordF' [$!]\n"; #print $fh $batF; # First post print $fh 'start "" "'.$batF.'"'."\n"; # Update #2 close($fh); my $sftpString1 = "sftp $winU\@$winS<