Solved

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

Posted on 2004-10-13
2
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Stressed Out?

Watch some penguins on the livecam!

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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 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