Is there a way to get the command line arguments.
I am using getopt(3) but if the arguments are more than one for a particular option than it just ignores the second argument. For eg
./a.out -x abc def
now abd will be got with -x using getopt "( x : )" and string abc\0def will get stored... (7 Replies)
Looking for a little help parsing some command line arguments in a bash script I am working on, this is probably fairly basic to most, but I do not have much experience with it.
At the command line, when the script is run, I need to make sure the argument passed is a file, it exists in the... (3 Replies)
Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script?
The output should be something like this:
User userid has a home directory of /path/directory
the default shell for this user is /path/shell (1 Reply)
Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script?
The output should be something like this:
User userid has a home directory of /path/directory
the default shell for this user is /path/shell (1 Reply)
Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script?
The output should be something like this:
User userid has a home directory of /path/directory
the default shell for this user is /path/shell (5 Replies)
Hello All,
i am known to the limitation of different shells while passing more than 9 command line arguments
i just tried the example below
i do see my current shell is tcsh
echo $SHELL
/bin/tcsh
so if i make my script executable and run it
output is
... (6 Replies)
Hi... can anyone please help me out in using the CASE and command line argument in shell script... i am bit new to shell scripting...below i have explained my proble with example...
say i have an executable file with name 'new1.sh' and there are 3 functions in it a(), b() and c()....and there... (5 Replies)
Hi,
I've a python script called aaa.py and passing an command line option " -a" to the script like, ./aaa.py -a
& Inside the script if the -a option is given I do some operation if not something else.
code looks like
./aaa.py -a
.
.
if options.a
---some operation---
if not options.a... (1 Reply)
hi,
I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script.
e.g.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{ int i;
for (i=1;i<argc; i++)
{
... (2 Replies)
Hi guys,
I am having trouble with this script. What i want it to do is to iterate all command line arguments in reverse order. The code below does this fine but i need the output to print the words on separate lines instead of one line:
#!/bin/bash
#Takes in the arguments and displays them... (7 Replies)
Discussion started by: pipeline2012
7 Replies
LEARN ABOUT DEBIAN
string::shellquote
ShellQuote(3pm) User Contributed Perl Documentation ShellQuote(3pm)NAME
String::ShellQuote - quote strings for passing through the shell
SYNOPSIS
$string = shell_quote @list;
$string = shell_quote_best_effort @list;
$string = shell_comment_quote $string;
DESCRIPTION
This module contains some functions which are useful for quoting strings which are going to pass through the shell or a shell-like object.
shell_quote [string]...
shell_quote quotes strings so they can be passed through the shell. Each string is quoted so that the shell will pass it along as a
single argument and without further interpretation. If no strings are given an empty string is returned.
If any string can't be safely quoted shell_quote will croak.
shell_quote_best_effort [string]...
This is like shell_quote, excpet if the string can't be safely quoted it does the best it can and returns the result, instead of dying.
shell_comment_quote [string]
shell_comment_quote quotes the string so that it can safely be included in a shell-style comment (the current algorithm is that a sharp
character is placed after any newlines in the string).
This routine might be changed to accept multiple string arguments in the future. I haven't done this yet because I'm not sure if the
strings should be joined with blanks ($") or nothing ($,). Cast your vote today! Be sure to justify your answer.
EXAMPLES
$cmd = 'fuser 2>/dev/null ' . shell_quote @files;
@pids = split ' ', `$cmd`;
print CFG "# Configured by: ",
shell_comment_quote($ENV{LOGNAME}), "
";
BUGS
Only Bourne shell quoting is supported. I'd like to add other shells (particularly cmd.exe), but I'm not familiar with them. It would be
a big help if somebody supplied the details.
AUTHOR
Roderick Schertler <roderick@argon.org>
SEE ALSO perl(1).
perl v5.8.4 2005-05-03 ShellQuote(3pm)