run command Unix on a single line


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers run command Unix on a single line
# 1  
Old 02-04-2008
Question run command Unix on a single line

Hi everybody..
I need to enter in bash mode and then run a command and this just in a single command line.

I tried : "bash ^M| somecommand" but nothing..
How do I do to simulate the return button just right after the bash command ?

Thanks..
# 2  
Old 02-04-2008
What for?

Or why?
Do you realize what is being asked?
# 3  
Old 02-04-2008
ok..

you type bash.. then return.. and I am in bash mode.
So , now I type a command like iostat or other.. and then I get the output to console.
Well, I would like these 2 steps on a single command line since I have to run this 2 input from .NET code.

Hope I make myself clear.. .. thank you..
# 4  
Old 02-04-2008
Quote:
Originally Posted by Riddick61
ok..

you type bash.. then return.. and I am in bash mode.
So , now I type a command like iostat or other.. and then I get the output to console.
Well, I would like these 2 steps on a single command line since I have to run this 2 input from .NET code.

Hope I make myself clear.. .. thank you..
You can use something like...

bash << END
command
<<END
# 5  
Old 02-04-2008
Wouldn't a semicolon work?

I.E. Usually you can put multiple commands on a single line by seperating them with a semicolon:

command [argument] ; command [argument] ; command [argument] ... etc.
is the same as:
command [argument] <NL>
command [argument] <NL>
command [argument] <NL>
...
etc.

NOTE:

The vertical bar you used, usually called 'Pipe', does NOT seperate commands the same way. It is used to direct the output of one command to be used as the input of the next command. I'm fairly certain that using it as you indicated would not work at all, unless the first command had output that the second command could use.
# 6  
Old 02-04-2008
semicolons wont work...

for eg:

bash; ls

ls will not be executed unless u exit bash....
what he wants is to execute ls in the newly created bash
# 7  
Old 02-04-2008
Quote:
Originally Posted by quintet
semicolons wont work...

for eg:

bash; ls

ls will not be executed unless u exit bash....
what he wants is to execute ls in the newly created bash

Yes, you are right. That is what I want.
I tried bash << END
command
<<END but doesn't enter bash... Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run simple single command on multiple Linux servers?

Hi All, How can i run a single command on multiple servers with or without giving credentials. I have a file(servers.txt) which has got list of servers and i want to run a command lsb_release -dr on all these servers and get output of those servers against each server. I tried below code... (9 Replies)
Discussion started by: darling
9 Replies

2. Solaris

Can I run repair on lot of blocks with single command ?

Hi, I have Solaris-10 OS on T5220. Both local disks were mirrored under SVM. Somehow when one disk gone bad (c0t1d0), other disk (c0t0d0) also got lot of bad block. We have readable data only on c0t0d0, but as soon as server comes after, it hangs when I run few commands because of read errors,... (1 Reply)
Discussion started by: solaris_1977
1 Replies

3. UNIX for Dummies Questions & Answers

To find and display the middle line in a file using single line command.

Hi all, How can i display the middle line of a file using a single line command? (6 Replies)
Discussion started by: Lakme Pemmaiah
6 Replies

4. Shell Programming and Scripting

Su and run single line command

myenv.sh script sets LOG_DIR variable. I can run the script and echo the variable in a single line as: # First set LOG_DIR to some dummy 'NONE' value $ export LOG_DIR="NONE" $ echo ${LOG_DIR} NONE $ cat /tmp/bin/myenv.sh export LOG_DIR="/tmp/log" #The below command doesn't show the... (2 Replies)
Discussion started by: ysrini
2 Replies

5. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

6. UNIX for Dummies Questions & Answers

How to run multiple command in a single line?

Normally i would do this- cd abc ls -ltr I wish to run above command in a single line, like this- cd abc | ls -ltr But above command doesn't works, it simply runs the second command, ignoring the 1st one. :confused: (4 Replies)
Discussion started by: boy18nj
4 Replies

7. Solaris

Single maintence mode cannot run any command on M4000

Hii All I was building two M4000 servers and one was successfully installed. Other one /usr has been unmounted. my putty session got disconnected and i connected to console where it asked for root single maintence # # init 0 not foung # df -h not found # xscf>poweroff -a xscf>... (8 Replies)
Discussion started by: seems
8 Replies

8. UNIX for Advanced & Expert Users

unix command for terminal - view sequences as a single line?

Hello, I'm looking for some code that will list sequences of files as a single line. ie, sequences of files like this: filename.1.ext filename.2.ext filename.3.ext filename.4.ext filename.5.ext filename.6.ext filename.7.ext filename.8.ext filename.9.ext filename.10.ext would... (6 Replies)
Discussion started by: kentm
6 Replies

9. UNIX for Dummies Questions & Answers

How to run multiple command in single command?

Dear Unix Guru, I have several directories as below /home/user/ dir1 dir2 dir3 Each directory has different size. I want to print each directory size (Solaris command du -hs .) Can you please guide me how to achieve this? Thanks Bala (2 Replies)
Discussion started by: baluchen
2 Replies

10. Shell Programming and Scripting

single line command

i need to search for a single pattern in three different logs....what would be the best one line script???? (4 Replies)
Discussion started by: roshanjain2
4 Replies
Login or Register to Ask a Question