LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-17-2009, 01:33 AM   #1
sathiawathi.m
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Rep: Reputation: 0
Unhappy how to write command line arguments as values, into a file which contains variables


Hi,

How to write command line arguments as values, into a file which contains variables...

Thanks...
 
Old 07-17-2009, 01:52 AM   #2
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Command line arguments are represented as $1, $2, etc.

var=""

if [ -n "$1"]; then
var=$1
fi
 
Old 07-17-2009, 02:27 AM   #3
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,489

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Only 9 commands line arguments are permitted in /bin/sh, that is you can't reference the 10th argument as $10. However you can pass an unlimited number of arguments if you use the shift built-in. In /bin/bash you can reference arguments after the 9th by using brackets, that is ${10}, ${11} and so on. More details here, in section "positional parameters".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding values to a file and making a graph with it by command line (Spreadsheet?) Romanus81 Programming 4 07-02-2008 09:14 AM
command line arguments containing ( Lotharster Linux - Newbie 3 01-05-2006 08:43 AM
Passing a text file to the command line as arguments wimnat Linux - General 2 12-05-2005 08:09 AM
Streaming in values without defined command line arguments liguorir Linux - Software 1 05-07-2004 02:40 AM
Help with command line arguments ? synapse Linux - Newbie 2 02-23-2004 02:25 AM


All times are GMT -5. The time now is 05:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration