1

I am running a bash script to run a few tests on a program that I've made. When running the tests I wanted to be able to see the commands printed in the terminal. For this I used -x at the start.

It's all fine, but in the commands that use a '<', the operator is not shown, nor the word right after it. I would like it to show the entire command.

Also it'd be nice to not show 'echo -e \n'. I've tried with set +x and set-x but I always end up showing 'set +x' or 'set -x' or both.

#!/bin/bash -x
cat entrada3.txt
./tp0 < entrada3.txt
./tp0 -p compress < entrada3.txt -o salida3.txt

Expected result:

+ cat entrada3.txt
AAAAAAAAAA
+ ./tp0 < entrada3.txt
65,256,257,258,10
+ ./tp0 -p compress < entrada3.txt -o salida3.txt

Actual result:

+ cat entrada3.txt
AAAAAAAAAA
+ ./tp0
65,256,257,258,10
+ ./tp0 -p compress -o salida3.txt
SGali
  • 70
  • 1
  • 1
  • 6

1 Answers1

1

You might be looking for the "-v" option instead of "-x".

Tomasz Noinski
  • 456
  • 2
  • 10
  • I'd like to add newlines, but not show that, like after entrada3.txt, I do stuff with entrada4.txt. Is there any easy way to not show 'set +v' or 'echo -e "\n"' that you can think of? Thanks for the answer. – SGali Apr 23 '19 at 23:48
  • `set -v` and `set -x` will print all commands. Maybe a workaround would be something like `catn` instead of `cat` which would contain `cat "$@"; echo` – tripleee Apr 24 '19 at 04:30