There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it?
perl 5.6.1:
when i try a "system" command(with if loops for $?), i get this:
child exited with value 1
what is meant by this $? values and what does it meant if it returns 1?.. (0 Replies)
in "cmd" command i want to copy the ouput of the command excuted to a particular file in a directory.
How to do this..??
Ex : $telnet->cmd(String => 'allip:acl=a1;',Prompt => '/</');
i want to copy o/p of the command "allip:acl=a1;" in a log file in a particular directory.
Plz suggest.. (1 Reply)
Hello,
I need help with the eval command.
I have been building a lengthy cmd using eval, and I need to create $var from the output of the cmd. Here is what I have.
Out=/dfezz1/output.txt
Node="'LPAR Info:'"
Gr3p0=" |grep"
Printc=" prtconf"
Output1=" 1>>$Out 0>&1"
Cat1="cat... (8 Replies)
Hi everybody;
I try to code a script perl to list all services that are active "ON" with a chkconfig -- list
the problem is that code list all services which are active or not.
#!/usr/bin/perl
use strict;
use warnings;
open(FILE,"-|") || exec "chkconfig --list |grep ON";... (2 Replies)
Hi guys,
I have a shell script where I have the following:
for i in ad0 ad1
do
gpart create -s gpt $i || echo "Cannot create GPT partition on "$i". Exiting ..."
gpart add -s 128 -t freebsd-boot $i || echo "Cannot add freebsd-boot partition on "$i". Exiting ..."
gpart add -s 4G -t... (2 Replies)
file /sbin/ifconfig.net-tools
/sbin/ifconfig.net-tools: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped
Does someone know what's the "x86-64" how it get this?
what's the 2.6.16, how it get this
and in some... (5 Replies)
Hi All,
I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd.
What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Hi
Is it possible to get the below code working.?
cmd="grep 'Name:' |awk -F' ' '{print $2}'|xargs -i basename {}"
echo $cmd
(
rman target / <<EOF1
LIST COPY ;
exit
EOF1
) | `$cmd`
in nutshell I want to be able to preset cmd as depending on script flow it can be... (2 Replies)
Hi All,
i am trying to ssh to a remote machine and execute certain command to remote machine through script.
i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as
expect: spawn id exp5 not open
while executing
"expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies
LEARN ABOUT NETBSD
getopt
GETOPT(1) BSD General Commands Manual GETOPT(1)NAME
getopt -- parse command options
SYNOPSIS
args=`getopt optstring $*`
set -- `getopt optstring $*`
DESCRIPTION
getopt is used to break up options in command lines for easy parsing by shell procedures, and to check for legal options. [Optstring] is a
string of recognized option letters (see getopt(3)); if a letter is followed by a colon, the option is expected to have an argument which may
or may not be separated from it by white space. The special option ``--'' is used to delimit the end of the options. getopt will place
``--'' in the arguments at the end of the options, or recognize it if used explicitly. The shell arguments ($1, $2, ...) are reset so that
each option is preceded by a ``-'' and in its own shell argument; each option argument is also in its own shell argument.
getopt should not be used in new scripts; use the shell builtin getopts instead.
EXAMPLES
The following code fragment shows how one might process the arguments for a command that can take the options [a] and [b], and the option
[c], which requires an argument.
args=`getopt abc: $*`
if [ $? -ne 0 ]; then
echo 'Usage: ...'
exit 2
fi
set -- $args
while [ $# -gt 0 ]; do
case "$1" in
-a|-b)
flag=$1
;;
-c)
carg=$2; shift
;;
--)
shift; break
;;
esac
shift
done
This code will accept any of the following as equivalent:
cmd -acarg file file
cmd -a -c arg file file
cmd -carg -a file file
cmd -a -carg -- file file
IEEE Std 1003.2 (``POSIX.2'') mandates that the sh(1) set command return the value of 0 for the exit status. Therefore, the exit status of
the getopt command is lost when getopt and the sh(1) set command are used on the same line. The example given is one way to detect errors
found by getopt.
DIAGNOSTICS
getopt prints an error message on the standard error output when it encounters an option letter not included in [optstring].
SEE ALSO sh(1), getopt(3)HISTORY
Written by Henry Spencer, working from a Bell Labs manual page. Behavior believed identical to the Bell version.
BUGS
Whatever getopt(3) has.
Arguments containing white space or embedded shell metacharacters generally will not survive intact; this looks easy to fix but isn't.
The error message for an invalid option is identified as coming from getopt rather than from the shell procedure containing the invocation of
getopt; this again is hard to fix.
The precise best way to use the set command to set the arguments without disrupting the value(s) of shell options varies from one shell ver-
sion to another.
BSD November 28, 2009 BSD