I am quite clueless so am sorry if I am doing something totally wrong, but I saved as a file:
Code:
#! /bin/sh
for file in *
do
sed -i '$a\\n\n' $file
done
made a directory
$ ls tst
one.txt two.txt
$ bash ../sedscript
sed: 1: "one.txt": invalid command code o
sed: 1: "two.txt": undefined label 'wo.txt'
It didn't say
sed: -i may not be used with stdin
this time, so I must have done something differently this time, but I'm not sure what. It doesn't edit the files.
The script
Code:
#! /bin/sh
for file in *
do
cat ../returnsfile >> $file
done
works with the test folder, but not the folder of files I actually want to edit, where it returns many identical errors:
$ bash script
../script: line 4: $file: ambiguous redirect
(lots of these)