Solved

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

Posted on 2004-10-13
2
194 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
qos on linux 3 103
Linux daemon 11 356
Chinese translation in RedHat 10 54
„dd“ vs „ddrescue“ 28 233
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 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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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