I have a problem with reading a pattern from a script file to another file. Basically the output from one file should be used as an input to the other script file. The output from the maze_gen is an array of # and space symbols. the following example 5 7 represents the height and width of the output.
if [`./maze_gen 5 7 | grep -E "[^# ]"` ]; then
echo no
else
echo yes
fi
So here maze_gen
is a file that produces a series of #
symbols with spaces.
This will receive as an input file that I am currently working on. There is something wrong with my code and I just can't check if the input has only #
characters.
maze_gen
to your question? – Natolio Apr 12 '21 at 21:19-m 1
[can use the return status] or add-c
gives a count output. But as @Natolio says - attach a sample please. – Mr R Apr 12 '21 at 21:31-q
option to suppress normal output. i.e.if [ ./maze_gen 5 7 | grep -q -E "[^# ]" ]; then
– cas Apr 13 '21 at 05:05if ./maze_gen | grep -q; then
. (roaima linked shellcheck.net earlier, an it also mentions that) – ilkkachu Apr 13 '21 at 09:33