Hi Group ,
I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages.
- i m writing
>write user-id
! ls
o
ctrl-d
inspite of executing the command ls,other terminal shows ! ls.
Thnx in advance. (2 Replies)
I'm trying to populate a command line into a variable. It appears to be executing, instead. Here's an example:
mycmd=''
if ...; then
$mycmd='sudo '
fi
$mycmd=$mycmd 'sed -i prev s/aaa/bbb/' $myfile
res=`$mycmd`
(I'm also not sure of the best way to execute the command from the... (1 Reply)
Hi,
I'm trying to run the following command using sh -c
ie
sh -c "while read EachLine
do
rm -f $EachLine ;
done < file_list.lst;"
It doesn't seem to do anything.
When I run this at the command line, it does remove the files contained in the list so i know the command works
ie... (4 Replies)
Hi,
I have a script below for extracting xml from a file.
for i in *.txt
do
echo $i
awk '/<.*/ , /.*<\/.*>/' "$i" | tr -d '\n'
echo -ne '\n'
done
.
I read about using multi threading to speed up the script.
I do not know much about it but read it on this forum.
Is it a... (21 Replies)
I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found"
My code is as follows:
--------------------------
#!/bin/sh
user="test"
DIR="/bldtmp/"$user
VIEW="test.view1"
echo "TMPDIR before export... (4 Replies)
Hi,
I have a problem where I need to make this input:
nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a
nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b
look like this output:
nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
how to run a command, such as "ls -l core" from one lpar to check multi lpars if core file exist?
or what way can do a command on all lpars from one lpar?
Thanks (1 Reply)
Hello :)
new to bash not to programming.
I have an on-going need to change the owning group on sets of files and directories from the one they were created with or changed to on update to the one they need to have going forward.
find {target_root} -group wrong_group
gets me a newline... (4 Replies)
Hello i am having an issue with bash script and this is the code
now=$(cat hosts1.txt | awk '{print $2;}')
while read n ;do
ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers'
When i execute only part with cat, it... (8 Replies)
The following is a multi-line shell command example:
$cargo build
Compiling prawn v0.1.0 (/Users/ag/rust/prawn)
error: failed to resolve: could not find `setup_panix` in `human_panic`
--> src/main.rs:14:22
|
14 | human_panic::setup_panix!();
| ... (2 Replies)
Discussion started by: yogi
2 Replies
LEARN ABOUT PLAN9
arg
ARG(2) System Calls Manual ARG(2)NAME
ARGBEGIN, ARGEND, ARGC, ARGF, arginit, argopt - process option letters from argv
SYNOPSIS
#include <u.h>
#include <libc.h>
ARGBEGIN {
char *ARGF();
Rune ARGC();
} ARGEND
extern char *argv0;
/* Alef only */
Arg *arginit(int argc, byte **argv);
Rune argopt(Arg *arg);
byte *argf(Arg *arg);
DESCRIPTION
These macros assume the names argc and argv are in scope; see exec(2). ARGBEGIN and ARGEND surround code for processing program options.
The code should be the cases of a C switch on option characters; it is executed once for each option character. Options end after an argu-
ment --, before an argument -, or before an argument that doesn't begin with -.
ARGC() returns the current option character.
ARGF() returns the current option argument: a pointer to the rest of the option string if not empty, or the next argument in argv if any,
or 0. ARGF must be called just once for each option that takes an argument.
After ARGBEGIN, argv0 is a copy of argv[0] (conventionally the name of the program).
After ARGEND, argv points at a zero-terminated list of the remaining argc arguments.
Alef
The Alef argument processing routines are unrelated. Instead, an aggr called Arg is initialized by a call to arginit. Successive calls to
argopt return successive option characters, or zero at the end of the options. After a call to argopt, argf will return any argument
string associated with the option.
EXAMPLES
This C program can take option b and option f, which requires an argument.
#include <u.h>
#include <libc.h>
void
main(int argc, char *argv[])
{
char *f;
print("%s", argv[0]);
ARGBEGIN {
case 'b':
print(" -b");
break;
case 'f':
print(" -f(%s)", (f=ARGF())? f: "no arg");
break;
default:
print(" badflag('%c')", ARGC());
} ARGEND
print(" %d args:", argc);
while(*argv)
print(" '%s'", *argv++);
print("
");
exits(0);
}
Here is the output for the run prog -bffile1 -r -f file2 arg1 arg2
prog -b -f(file1) badflag('r') -f(file2) 2 args: 'arg1' 'arg2'
This Alef program accepts options b and, with an attached file name, f.
#include <alef.h>
void
main(int argc, byte **argv)
{
int a, ac, bflag;
byte *file;
Arg *arg;
arg = arginit(argc, argv);
while(ac = argopt(arg)) switch(ac){
case 'b':
bflag = 1;
break;
case 'f':
file = argf(arg);
break;
}
for(a=0; a<arg->ac; a++)
print("argument %s
", arg->av[a]);
}
SOURCE
/sys/include/libc.h
ARG(2)