[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2004-10-13
2
Medium Priority
?
199 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 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