I'm trying to run bash script written in here: Link
I fixed script above like this:
#!/bin/bash
keyFile=video.key
openssl rand 16 > $keyFile
encryptionKey=cat $keyFile | hexdump -e '16/1 "%02x"'
splitFilePrefix=stream
encryptedSplitFilePrefix=enc/${splitFilePrefix}
numberOfTsFiles=ls ${splitFilePrefix}*.ts | wc -l
for (( i=1; i<$numberOfTsFiles; i++ ))
do
initializationVector=printf '%032x' $i
openssl aes-128-cbc -e -in ${splitFilePrefix}$i.ts -out ${encryptedSplitFilePrefix}$i.ts -nosalt -iv $initializationVector -K $encryptionKey
ran script like this: ./script.sh
but bash keeps yelling like this:
./script.sh: line 5: video.key: command not found
./script.sh: line 10: stream0.ts: command not found
0
./script.sh: line 17: syntax error: unexpected end of file
I have no idea why..
I searched about the error and checked ~/.rnd owner, .sh file chmod +x, $PATH problems, but all of them did not work.
keyFile=”video.key”, line 10: should be like this:splitFilePrefix=”stream”etc. Pls check the original script again