Solved

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

Posted on 2004-10-13
2
192 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
Comment Utility
#!/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
Comment Utility
Thanks, I rechecked and it is working....

I am losing my mind..
0

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

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

17 Experts available now in Live!

Get 1:1 Help Now