Dragon0x40
asked on
What does a > prompt in Linux mean
When I run the following command:
cat <<word My text word
>
and hit enter the prompt changes to a > and I have to hit ctrl + c to get out of that.
My intention was to have a screen output of My text but I have since found out that this will work in a shell script.
#!/bin/bash
cat <<word My text word
and if I name the script myscript and run the script I will get the desired effect of reading the text until it gets to my delimiter which is word.
./myscript
My text
So the << is used to produce a here document and I have looked at the man page but I still don't know what the > sign means.
http://linux.die.net/abs-guide/here-docs.html
I am curious what the > prompt is asking for or what it is doing?
Thank you
cat <<word My text word
>
and hit enter the prompt changes to a > and I have to hit ctrl + c to get out of that.
My intention was to have a screen output of My text but I have since found out that this will work in a shell script.
#!/bin/bash
cat <<word My text word
and if I name the script myscript and run the script I will get the desired effect of reading the text until it gets to my delimiter which is word.
./myscript
My text
So the << is used to produce a here document and I have looked at the man page but I still don't know what the > sign means.
http://linux.die.net/abs-guide/here-docs.html
I am curious what the > prompt is asking for or what it is doing?
Thank you
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cat <<word My text word
>
Is cat waiting for input?
If so what is it going to do with it?
I think that I have tried typing in "word" and pressing enter but it does not return me to the bash prompt.
>
Is cat waiting for input?
If so what is it going to do with it?
I think that I have tried typing in "word" and pressing enter but it does not return me to the bash prompt.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#cat <<word My text word
>some
>text
>hitting enter after each word
>word
cat: My: No such file or directory
cat: text: No such file or directory
cat: word: No such file or directory
#cat >word
>my text
>word
my text
>some
>text
>hitting enter after each word
>word
cat: My: No such file or directory
cat: text: No such file or directory
cat: word: No such file or directory
#cat >word
>my text
>word
my text
Is it a homework question?
$ cat << EOD
>abc
>def
EOD
Would do same as cat FILE, where FILE has content of whatever was typed between EOD markers
$ cat > word
> x
>y
text
Ctrl-D
Will rewrite file "word" (or file pointed to by symlink called word) with all that was typed until EOF marker (typically EOF=^D)
$ cat << EOD
>abc
>def
EOD
Would do same as cat FILE, where FILE has content of whatever was typed between EOD markers
$ cat > word
> x
>y
text
Ctrl-D
Will rewrite file "word" (or file pointed to by symlink called word) with all that was typed until EOF marker (typically EOF=^D)
ASKER
#!/bin/bash
cat <<word
My text
word
so when I run it I see this:
./myscript
My text