Solved

Passing a variable to a command switch...help plz

Posted on 2004-10-13
2
193 Views
Last Modified: 2010-04-22
Should be simple, possibly even just a syntax help...

I have a huge script, but in it I have a variable that increments... I want to pass this variable to a command such a head or tail I.E.

$inc is my variable that increments up...

I want to execute the command head with the "-n" option to specify how many lines I want it to head....

head -3 will return the top three lines..
I want somehow to do :
head -$inc

but that doesn't seem to work...
0
Comment
Question by:g8ballz0fyre
2 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 125 total points
ID: 12305629
#!/bin/bash
inc=3
head -$inc tmp.txt

the above seems to work for me .. is it what you want or sonething else
0
 

Author Comment

by:g8ballz0fyre
ID: 12305658
Thanks, I rechecked and it is working....

I am losing my mind..
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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

14 Experts available now in Live!

Get 1:1 Help Now