Sponsored Content
Top Forums UNIX for Beginners Questions & Answers UNIX/Shell function does not work as wished Post 303001541 by anonymuser on Monday 7th of August 2017 05:13:33 AM
Old 08-07-2017
Hello RudiC
Nice for seeing such a nice community here.

In my case, I want a basic table like a HTML.
Sorry for not being so exactly.

And for the other point.
Thank you a thousand times, I will check this out.

---------- Post updated at 04:13 AM ---------- Previous update was at 04:11 AM ----------

Quote:
Originally Posted by RudiC
Welcome to the forum.
(and thanks for using code tags correctly in your very first post!)

The output of df -h certainly is NOT a string but a few lines of text. I guess you assigned it to a shell variable; when printing that WITHOUT proper quoting / escaping the shell (which you fail to mention) will convert all line feeds into spaces and make it seem like a single string. Try printing using double quotes.

What do you mean by "table"? DB table, HTML table, spread sheet table, text file looking like a table?

For your second question, look into man ps for OUTPUT FORMAT CONTROL and STANDARD FORMAT SPECIFIERS; in your case %cpu might help.
Hello RudiC
Nice for seeing such a nice community here.

In my case, I want a basic table like a HTML.
Sorry for not being so exactly.

And for the other point.
Thank you a thousand times, I will check this out.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Will the continue function work ????

I have written a script which does a following functions:- 1) Check a area if it is mounted or not 2) If the area is not mounted it will prompt the user to mount the are. 3) Once the area is mounted and the option is given as Y or y the script continues... My question is will the below... (2 Replies)
Discussion started by: kamlesh_p
2 Replies

2. Shell Programming and Scripting

Substring function in UNIX shell script

Hi All, Following is the output of a find commnd to locate log directories for various projects of UNIX AIX box: /home/hbinz6pf/projectlibs/dpr_pfsdw_dev/&PH& /opt/tools/ds/Template/&PH& /data/ds/ms/hmsdw/projectlibs/dpr_ms_dev/&PH& /data/ds/riskmi/projectlibs/dpr_riskmi_dev/&PH&... (1 Reply)
Discussion started by: csrazdan
1 Replies

3. UNIX for Dummies Questions & Answers

Substring function in UNIX shell script

Hi All, Following is the output of a find commnd to locate log directories for various projects of UNIX AIX box: /home/hbinz6pf/projectlibs/dpr_pfsdw_dev/&PH& /opt/tools/ds/Template/&PH& /data/ds/ms/hmsdw/projectlibs/dpr_ms_dev/&PH& /data/ds/riskmi/projectlibs/dpr_riskmi_dev/&PH&... (5 Replies)
Discussion started by: csrazdan
5 Replies

4. Shell Programming and Scripting

Cannot get grep to work within function.

Hello again, Am having an issue now with getting a simple grep command to work within a function.. The function is as below... function findRecord() { output=grep "001" recordDatabase echo $output } At the moment the "001"... (3 Replies)
Discussion started by: U_C_Dispatj
3 Replies

5. UNIX for Dummies Questions & Answers

copy *. does not work in function

Hi, I want to copy a file/directory ( recursively , if needed) and if destination directory does not exist create it ( with parent directory, if needed). funcopy () { if ; then echo "$2 exists , copying files" cp -r "$1" "$2" else echo "Directory does not exist;Create directory" mkdir... (1 Reply)
Discussion started by: greet_sed
1 Replies

6. Shell Programming and Scripting

How the Sleep function will work?

Hi All, I am new to Unix , there i am facing one problem with sleep command. that is .. in while loop i have defined sleep function .. my condition is like this while #i knew this is infinite loop do sleep 200 echo "hello " done. this condition will never become .. true... (3 Replies)
Discussion started by: mandlysreedhar
3 Replies

7. Shell Programming and Scripting

Function doesn't work

Hello, and here's my problem: I can't get my function to do what I want. When I call my function get_from_A_to_F I give it an argument $remainder. I want my function to substitute a number higher than 9 to a specific letter. If the argument is equal to 10 than it should change it to "A".... (8 Replies)
Discussion started by: linas
8 Replies

8. Shell Programming and Scripting

UNIX Shell script to work with .xml file

Hi Team, Could you please help me on below query: I want to retrieve XML elements from one .xml file. This .xml file has commented tags as well. so i am planning to write Unix command/script which 1.will chekc for this .xml file 2. it will ignore the commented XML lines. i.e. XML tags between... (3 Replies)
Discussion started by: waiting4u
3 Replies

9. Programming

Writing a UNIX shell script to call a C function and redirecting data to a .txt file

Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far: #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies

10. Shell Programming and Scripting

UNIX: passing stuff to a shell function

I have users that print files to selected printers. Instead of creating one function for each printer I would like to have just one and passing the files to print as well as the wanted printer. The following code does not work, of course. I'm expecting that $1 is the list of files to be printed... (6 Replies)
Discussion started by: emare
6 Replies
Net::Jabber::Server(3pm)				User Contributed Perl Documentation				  Net::Jabber::Server(3pm)

NAME
Net::Jabber::Server - Jabber Server Library SYNOPSIS
Net::Jabber::Server is a module that provides a developer easy access to developing applications that need an embedded Jabber server. DESCRIPTION
Server.pm seeks to provide enough high level APIs and automation of the low level APIs that writing and spawning a Jabber Server in Perl is trivial. For those that wish to work with the low level you can do that too, but those functions are covered in the documentation for each module. Net::Jabber::Server provides functions to run a full Jabber server that accepts incoming connections and delivers packets to external Jabber servers. You can use all or none of the functions, there is no requirement. For more information on how the details for how Net::Jabber is written please see the help for Net::Jabber itself. For a full list of high level functions available please see Net::Jabber::Protocol. Basic Functions use Net::Jabber qw(Server); $Server = new Net::Jabber::Server(); $Server->Start(); $Server->Start(jabberxml=>"custom_jabber.xml", hostname=>"foobar.net"); %status = $Server->Process(); %status = $Server->Process(5); $Server->Stop(); METHODS
Basic Functions new(debuglevel=>0|1|2, - creates the Server object. debugfile debugfile=>string, should be set to the path for the debug debugtime=>0|1) log to be written. If set to "stdout" then the debug will go there. debuglevel controls the amount of debug. For more information about the valid setting for debuglevel, debugfile, and debugtime see Net::Jabber::Debug. Start(hostname=>string, - starts the server listening on the proper jaberxml=>string) ports. hostname is a quick way of telling the server the hostname to listen on. jabberxml defines the path to a different jabberd configuration file (default is "./jabber.xml"). Process(integer) - takes the timeout period as an argument. If no timeout is listed then the function blocks until a packet is received. Otherwise it waits that number of seconds and then exits so your program can continue doing useful things. NOTE: This is important for GUIs. You need to leave time to process GUI commands even if you are waiting for packets. The following are the possible return values for each hash entry, and what they mean: 1 - Status ok, data received. 0 - Status ok, no data received. undef - Status not ok, stop processing. IMPORTANT: You need to check the output of every Process. If you get an undef then the connection died and you should behave accordingly. Stop() - stops the server from running and shuts down all sub programs. AUTHOR
By Ryan Eatmon in January of 2001 for http://jabber.org. COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2004-08-17 Net::Jabber::Server(3pm)
All times are GMT -4. The time now is 09:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy