?
Solved

how can i store the o/p of Unix cmd to Shell ver.

Posted on 2000-04-29
7
Medium Priority
?
169 Views
Last Modified: 2010-04-21
i want to store the Output of Cmd like
 " wc -c filename" in a Shell var...
 how can i do it..
thanx
0
Comment
Question by:vmahendru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 

Accepted Solution

by:
ravindra042100 earned 200 total points
ID: 2761792
Hello, try this ..

sys>cat ans
#!/usr/bin/ksh
ATT=`wc -l trialfile`
echo $ATT

This should work ...
0
 

Author Comment

by:vmahendru
ID: 2761892
Adjusted points from 25 to 50
0
 

Author Comment

by:vmahendru
ID: 2761893
it did not work out... first tell me
 can u please explain the steps .. i am not very good in UNIX...
   
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

Expert Comment

by:ozo
ID: 2765280
What did not work when you tried it?
In which shell do you want to store a variable?
0
 

Author Comment

by:vmahendru
ID: 2768267
hi ozo
   i have written a program in c and in this program made one system call for grep... i want to store the output of this grep Cmd in my C program... can u help me how can i do it..
  thanx
0
 
LVL 84

Expert Comment

by:ozo
ID: 2770147
From C, you might call grep with popen insteead of system.
0
 

Author Comment

by:vmahendru
ID: 2772055
thanx ozo,  i got the answer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question