Solved

Question about sh bash scripts

Posted on 2003-11-16
2
252 Views
Last Modified: 2013-12-27
Hi,
I'd like to ask about some scripting tricks. How to write a script that will do these tasks:
1.Read from file first line and writes the readed line into variable. 2. How to write variable value into file.

thanks,
0
Comment
Question by:berniunas
2 Comments
 
LVL 38

Accepted Solution

by:
yuzh earned 100 total points
ID: 9762076
1.Read from file first line and writes the readed line into variable.

MYVAR=`head -1 inputfilename`
echo $MYVAR

2. How to write variable value into file.

echo $MYVAR > outputfile
0
 

Author Comment

by:berniunas
ID: 9762254
thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

759 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