Execution of sh file inside vi editor...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Execution of sh file inside vi editor...
# 15  
Old 01-06-2011
What Operating System and version you you have? (uname -a).


Quote:
Your code :!ps -f is showing the commands firing at that time which is present inside the sh file but no sh file displaying which is running in backend.
The "ps -f" shows all processes running in foreground or background which were started from that terminal.
What does "... running in backend" mean?

Can you show an example of what you type and what actually happens?


@jlliagre
In HP-UX 11i the permissions on "fuser" are 644 bin bin. Also there is no "ptree" command.
# 16  
Old 01-06-2011
Quote:
Originally Posted by methyl
@jlliagre
In HP-UX 11i the permissions on "fuser" are 644 bin bin.
This is quite unfortunate. Is it a bug on your system or by design ?
Quote:
Also there is no "ptree" command.
Can you double check that. It seems it has been documented on HP-UX since at least 1993 and the open poster has ptree available.
# 17  
Old 01-06-2011
@jlliagre
I stand corrected. Looks like "ptree" "pgrep" and "pkill" were finally available in HP-UX 11.23. They were missing in 11.00 and 11.11 and I wrote my own scripts with the functionality I missed.

The "fuser" on HP-UX is weird because part of the output is directed to STDERR. This makes the output fiddly to process in Shell. There seems to be no rational reason for the permissions but they are standard issue.
To get just the Process Id's:
Code:
/usr/sbin/fuser filename 2>/dev/null

# 18  
Old 01-06-2011
I suspect from having used HP-UX for a while now that the reason
part of the outptut goes to STDERR instead of all to STDOUT or STDERR is so you can do as Methyl points out:

Code:
/usr/sbin/fuser filename 2>/dev/null

And get just the PID.

I still remember way back when trying to get fuser output through a pipe and failing miserably! Smilie
# 19  
Old 01-06-2011
This useful feature isn't HP-UX specific. There is no need to filter out the pids thanks to it. As long as ptree is available and accept a list of pids, the command I suggested should work just fine precisely because the stdout/stderr split:
Code:
 ptree $(pfiles nohup.out)


Last edited by jlliagre; 01-06-2011 at 10:33 AM..
# 20  
Old 01-06-2011
[QUOTE=methyl;302485764]What Operating System and version you you have? (uname -a).



The "ps -f" shows all processes running in foreground or background which were started from that terminal.
What does "... running in backend" mean?

Can you show an example of what you type and what actually happens?

Hi ,

Thanks a lot atlast i got it.
U r right :!ps -f command is OK.

I have tried in another terminal and found the sh file name.

Backend ---> Background

Also thanks to jlliagre ...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execution of loop :Splitting a single file into multiple .dat file

hdr=$(cut -c1 $path$file|head -1)#extract header”H” trl=$(cut -c|path$file|tail -1)#extract trailer “T” SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name If; then # start loop if it is a header While read I #read file Do... (4 Replies)
Discussion started by: SwagatikaP1
4 Replies

2. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

3. UNIX for Dummies Questions & Answers

Ctrl-V + Ctrl-J for newline character does not work inside vi editor

Hi friends, I am trying to add a newline char ('\n') between the query and the commit statement in the following shell script. #! /bin/sh echo "select * from tab; commit;" > data.sql I have tried typing in "Ctrl-V + Ctrl-J" combination which has inserted ^@ (NUL) character but the commit... (1 Reply)
Discussion started by: royalibrahim
1 Replies

4. Shell Programming and Scripting

Parallel execution of command inside file

Hi all, I have the requirement to generate the file containing following command eval /path/ dsjob -logdetail projectname JOBNAME /path/ 1. The file contains the above command say about 150 times i,e only the JOBNAME changes in every command 2. The commands must be written in such a way... (2 Replies)
Discussion started by: sanjay mn
2 Replies

5. Shell Programming and Scripting

Automating execution of commands inside a program

I have a program dnapars I execute the program from command line as following: ./dnapars The program then prompts me some message as a user menu from where I have to select a series of options in the order R U Y R. And then I copy the output file (outfile) in another result file. I wrote the... (3 Replies)
Discussion started by: deeptisjains
3 Replies

6. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

7. Solaris

vi editor garbled file

I am trying to edit a file and when I vi the file, I get rolling lines and garbled messages. So much that I did not want to edit the file for fear of screwing up the file. I am logged in a Sun Box through a Windows Hyperterminal to a SunFire box serial port. I presume that my display is not... (4 Replies)
Discussion started by: bluridge
4 Replies

8. 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

9. UNIX for Dummies Questions & Answers

Pasting text in VI editor from a different editor

Hi, I knw its a silly question, but am a newbie to 'vi' editor. I'm forced to use this, hence kindly help me with this question. How can i paste a chunk 'copied from' a different editor(gedit) in 'vi editor'? As i see, p & P options does work only within 'vi'. (10 Replies)
Discussion started by: harishmitty
10 Replies

10. Shell Programming and Scripting

how to know whether that file has eol or noeol before opening that file in VI editor

Hi, I want to check whether file has EOL or NOEOL before opening this file in VI editor. My file is very big its in terms of 15-20 MB. I am using ksh for this. When we opened the file in vi editor, normally at last line we are able to see whether this is eol or noeol file. But i does want... (1 Reply)
Discussion started by: HariRaju
1 Replies
Login or Register to Ask a Question