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

Posted on 2000-04-29
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..
Question by:vmahendru
  • 4
  • 2

Accepted Solution

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

sys>cat ans
ATT=`wc -l trialfile`
echo $ATT

This should work ...

Author Comment

ID: 2761892
Adjusted points from 25 to 50

Author Comment

ID: 2761893
it did not work out... first tell me
 can u please explain the steps .. i am not very good in UNIX...
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

LVL 84

Expert Comment

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

Author Comment

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..
LVL 84

Expert Comment

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

Author Comment

ID: 2772055
thanx ozo,  i got the answer

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now