user-defined functions, "$@", $jobs and $ps wwaxu


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting user-defined functions, "$@", $jobs and $ps wwaxu
# 1  
Old 12-28-2009
user-defined functions, "$@", $jobs and $ps wwaxu

Imagine a user-defined function.

Code:
func() { /usr/pkg/bin/program long-string-of-switches-and-configs  "$@" ;}

I execute it once. Then background it.
I execute another instance. Then bg it.

Code:
func unique-user-input
^Z
func unique-user-input
^Z

First I view with ps

Code:
ps wwaux

Here I can see the stdin for each instance.

Then to get the job id's I view with jobs command

Code:
jobs -l

Here I only see "$@", not stdin.

To my knowledge, ps cannot show the job id's. And jobs will not show the user input. Hence I currently use use both ps and jobs commands in order to distinguish and bg/fg the instances. There must be a smarter way.

I would like to know
- why I cannot see stdin in jobs command output (theory)
and welcome suggestions
- how I can distinguish instances and bg/fg without having to check both ps and jobs (practice).

Last edited by Scott; 12-28-2009 at 11:18 PM.. Reason: Added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

4. Shell Programming and Scripting

User defined functions in awk

Hi; Is der ne to to use user defined functions for the values in awk find $1 -type f -ls | nawk '{{print "|"$3"|"$5"|"$6"|"$8"|"$9"|"$10"|"} for(i=11;i<=NF;i++){printf("%s",$i)}}' In above command i want to append some values returned by user functions on line. thnks; ajay (1 Reply)
Discussion started by: ajaypadvi
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Red Hat

How to find out jobs scheduled by "at" command?

How to find out jobs scheduled by "at" command? (1 Reply)
Discussion started by: johnveslin
1 Replies

7. Shell Programming and Scripting

Strange behaviour with "set -e" and functions

Hi, This seems to be a recurrent problem on mailing lists and bug reports, but I've been unable to find a solution. Let's imagine we have this bash script: #!/bin/bash set -e fun() { echo "fun_start" test 1 = 2 echo "fun_end" } echo "main_start" fun echo "main_end"This... (1 Reply)
Discussion started by: tokland
1 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. Shell Programming and Scripting

communicating wth another user aside from "wall" and "write"

Hi, Can anyone suggest a Unix command or c-shell algorithm to simulate to behavior of "wall" command minus the "all users"? What I'm trying to do is to send a notice to just one particular user but i dont want other remotely-logged-on users to receive the message (on the pseudo-terminals). I... (6 Replies)
Discussion started by: Deanne
6 Replies
Login or Register to Ask a Question