Solved

Question about sh bash scripts

Posted on 2003-11-16
2
255 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Shell script errors 10 115
Linux : adding the new user with password option, 11 97
Move nodes from one TSM to another. 3 61
UNiX Script filesystem space usage Part2 54 80
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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 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…

863 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

22 Experts available now in Live!

Get 1:1 Help Now