views:

34

answers:

3

Hi All,

I'm writing a program where at some point in my loop I want to print to output whatever is stored in a separate file (an image). But if I code it like this:

for c in $LIST 
do
    clear
    ./image.0
done

And the "image.0" file contains only an image like this:

+----+
|    |
|
|
|
|
|
========

Then when I run my program I get this message:

./image.0: 1: +----+: not found
./image.0: 2: Syntax error: "|" unexpected

Why?

================================

So "cat" works, the image appears in the output but it's shifted in a strange way. Do you know why this would happen?

   +----+
        |    |
        |
        |
        |
        |
        |
        ========

Answer: I put printf "\n" that fixed the shifting image

A: 

Try to use the command cat to output the content of the image.0 file

cat ./image.0
epatel
+1  A: 

With ./image.0, you tell the shell to execute the image. You want to output it, so use cat image.0

Aaron Digulla
Do you know why would the image shift like that (description added above)?
goe
Never mind I got it to work, thanks
goe
A: 

./something will take something as a program and execute it. That's not what you want : to display the contents of a file, you can use the cat command, like this :

for c in $LIST 
do
    clear
    cat image.0
done
Pierre Bourdon