Todos los shells que probé leen un documento aquí -bien incluso sin el terminador, el documento aquí -simplemente terminará al final -del archivo -. Bash da una advertencia sobre esto, pero busybox/dash/ksh y zsh simplemente lo manejan en silencio.
Por ej.
$ cat heredoctest.sh
#!/bin/bash
cat -n <<EOF
foo
bar
$ bash heredoctest.sh
heredoctest.sh: line 4: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
1 foo
2 bar
Pero la muestra particular de código que presentas parece un error. Tal como está escrito, simplemente agregaría la declaración if -a myPath/myFile.append
, lo que no parece muy útil. Parece que el contenido del documento aquí -y el terminador simplemente faltan entre cat
y if
.
Вы можете объединить несколько sed
выражений, подобных этому:
sed -e 's/Sat/Saturday/g' -e 's/Sun/Sunday/g' <file>
Это заменит все вхождения Sat
на Saturday
и все вхождения Sun
на Sunday
.