How to issue a long command on unix

Hi,

Im trying to create a command template here. how can i issue this long command in one enter?

echo -e "\nIssue or Request - Analysis Summary \n\nMemory Utilization Utilization Threshold\n\nResolution Summary\n\n1. check Server Info";echo "$(uname -a;uptime;date)"; echo -e "\n\n2. check Memory Utilization\n";\echo -e "$(/opt/HPO/SMSPIv2/bin/memdetail)\n";echo -e "[Additional Information Log:]\n\nFinal Analysis: Swapspace Utilization is 2% and is below threshold limit\n\nStatus: Resolved\n"

when i execute the command it shows only a part of a command

------------------------------------------------------------------
#echo "$(uname -a;uptime;date)"; echo -e "\n\n2. check Memory Utilization\n";\echo -e "$(/opt/HPO/SMSPIv2/bin/memde <
> ion\n";\echo -e "$(/opt/HPO/SMSPIv2/bin/memde

Thanks

echo -e "\nIssue or Request - Analysis Summary \n\nMemory Utilization Utilization Threshold\n\nResolution Summary\n\n1. check Server Info";echo "$(uname -a;uptime;date)"; echo -e "\n\n2. check Memory Utilization\n";\echo -e "$(/opt/HPO/SMSPIv2/bin/memdetail)\n";echo -e "[Additional Information Log:]\n\nFinal Analysis: Swapspace Utilization is 2% and is below threshold limit\n\nStatus: Resolved\n"

I have executed the above command and I got the output as follows

Issue or Request - Analysis Summary

Memory Utilization Utilization Threshold

Resolution Summary

1. check Server Info
Linux ThinServer 2.6.26-2-686 #1 SMP Fri Aug 14 01:27:18 UTC 2009 i686 GNU/Linux
 14:12:32 up 2 days,  4:10, 37 users,  load average: 0.62, 0.81, 0.55
Fri Mar 12 14:12:32 IST 2010


2. check Memory Utilization

bash: /opt/HPO/SMSPIv2/bin/memdetail: No such file or directory


[Additional Information Log:]

Final Analysis: Swapspace Utilization is 2% and is below threshold limit

Status: Resolved

What is the problem you are facing?

What you looking for , I have executed this it is giving me some output.Explain your requirement clearly .

i cant execute the command as a whole...

Details:

#echo "$(uname -a;uptime;date)"; echo -e "\n\n2. check Memory Utilization\n";\echo -e "$(/opt/HPO/SMSPIv2/bin/memde                          <

it shows an arrow at the end. maybe if someone can help me modify my command so i can execute it as a one long command.

btw im connecting to the server remotely

I think your PS2 variable is set like that.
Just use

echo $PS2

It will show a character. This is known as command continuation character.
For you this might be set to that character.

do i need to add that to my command? :confused:

No need. This will be automatically displayed in your shell prompt.
This indicates the user that the command is not properly end.

For example.

echo 'hello

Here the command is not properly end. Because the single quote is not enclosed.
For this it will show like

>

Once i have given the ' (single quote) then the command is properly end and will give the output as hello.
So it is better you ensure that whether all the single/double quotes / other things enclosed and ended properly.

i get what your saying. but is it possible to just edit my command so i can execute it without having to continue a command?

What's happening is that your command exceeds the length of buffer allowed by your shell. Or youve got an unclosed parans/quote. This buffer length varies by shell, OS, etc, but a good rule of thumb might be 250 bytes of entry and then escaping a return:

echo "blah...blah...blah..." \
"blah...blah...blah..."

Otherwise, you might explore variables some and letting the shell interpolate some of the values for you. This way some of the long strings and probable confusion over unclosed parans, etc, could also be eliminated.

The $PS2 variable is a system variable that you can define on the fly, or define in your .profile as a visual cue for such line breaks. It probably defaults to ">".

---------- Post updated at 07:18 ---------- Previous update was at 07:18 ----------

What's happening is that your command exceeds the length of buffer allowed by your shell. Or youve got an unclosed parans/quote. This buffer length varies by shell, OS, etc, but a good rule of thumb might be 250 bytes of entry and then escaping a return:

echo "blah...blah...blah..." \
"blah...blah...blah..."

Otherwise, you might explore variables some and letting the shell interpolate some of the values for you. This way some of the long strings and probable confusion over unclosed parans, etc, could also be eliminated.

The $PS2 variable is a system variable that you can define on the fly, or define in your .profile as a visual cue for such line breaks. It probably defaults to ">".

thx curleb :confused: