shell scripts without editor


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers shell scripts without editor
# 1  
Old 04-13-2008
shell scripts without editor

hello,

is there a way that i can produce a shell script without using editors..
i want it to be executable by sh....
my problem is that i dont know how to create the script eg. psycho to put the echo inside to output my message... but i dont want to use editor
# 2  
Old 04-13-2008
i know that there is a way to produce a shell script using the cat command.
heres how

cat >psycho
echo -n "hello psycho"
but when executing it the output is written next to the login name

hello psycho psycho@psycho-laptop:

Last edited by psychobeauty; 04-13-2008 at 02:47 PM..
# 3  
Old 04-13-2008
Where would you like to see the output?
# 4  
Old 04-13-2008
just in an empty line like where the output of
Code:
cat myfile

when we want to see the contens of the files is dispalayed in an empty line ...
# 5  
Old 04-13-2008
Your use of "echo -n" is what leaves off the final newline from the output. Take out the -n and it should work (if I understand you correctly).
# 6  
Old 04-13-2008
yeap it WORKSSS Smilie
THANXXXX

CAN U HELP ME WITH THOSE TOO ERA???
Without using an editor, modify your shell script so that, after displaying the greeting, it waits for exactly two minutes, and then displays the word “goodbye”.
Execute your modified script in the background so that its output appears in a file ‘hibye'.
Before the above command finishes, execute a command which waits (does nothing) for 10 minutes. Stop (but do not kill) this process. Then, before your shell script finishes executing, display a list of current jobs and kill the ‘do nothing' job.
Bring your shell script job into the foreground and wait for it to finish.
# 7  
Old 04-13-2008
Is this a homework question? If so, we can't help you, have a read of the:

https://www.unix.com/unix-dummies-que...om-forums.html

Assuming that it's not, what is the real world problem of your question?

Regards
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to overwrite shell script using vi editor

I have an existing shell script that I am trying to modify. I have about 10 lines of info I want to overwrite using text someone emailed to me. I guess what I am trying to do basically is like a copy/paste, but it's not working for me. I am using Cygwin and vi editor. I open the script and... (4 Replies)
Discussion started by: kimberlyg2007
4 Replies

2. Shell Programming and Scripting

Using Ex editor commands in a shell script - Help!

Hi all, I am trying to use the Ex editor and its commands in a script - more specifically within an if statement within a while loop. Here are the basics of the loop: cat $file1 | while read line do grep $line $file2 if ] then echo $line > $file2 elseex $file2 /ESI185... (4 Replies)
Discussion started by: luke222010
4 Replies

3. UNIX for Dummies Questions & Answers

Modifying a shell script without using an editor

Hi all, I really wan't to know that how to edit a shell script with out using an editor.. Is there any command? (4 Replies)
Discussion started by: buddhi
4 Replies

4. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

5. UNIX for Dummies Questions & Answers

New to shell scripts

Hi, Probably a real easy one for someone...I need to have a scheduled cp job run from crontab to copy certain files and directories to a shared NFS storage. The script I have works fine, except I need to exclude certain directories to stop issues with symbolic links, can someone explain... (2 Replies)
Discussion started by: paul.duncalf
2 Replies

6. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set... (6 Replies)
Discussion started by: aarora_98
6 Replies

7. AIX

Shell Scripts

I would like to seek some expertise of all our AIX experts on board. 1) I would like know how to get a return exit code of a command. I found that there are exist code for each and every command run in AIX but I just can't get the return code from my scripts. A=`cp /home/abc/abc.txt... (7 Replies)
Discussion started by: kwliew999
7 Replies

8. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

9. Shell Programming and Scripting

shell scripts help

Hi, I am not experienced in shell scripts, I hope someone can give some hint for the following problem I have html file like this <html> <body> Some stuff More stuff <pre> A B </pre> Still more stuff And more <pre> C D </pre> Additional stuff </body> (2 Replies)
Discussion started by: ccp
2 Replies

10. UNIX for Dummies Questions & Answers

about shell scripts

Hi, i have made a script which makes some analyses on some differnet hosts. but i have a problem to make this script more quicker ... i would like to enter more a one hosts in the query (in my script are this: Pls enter the Hostname ... read hostname for i in $hostname do echo... (5 Replies)
Discussion started by: scottl
5 Replies
Login or Register to Ask a Question