11-13-2006
If this isn't homework, why can't you just write a shell script?
(We don't allow homework on the forums)
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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)
Discussion started by: Aashish
2 Replies
2. Shell Programming and Scripting
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)
Discussion started by: littlejon
1 Replies
3. Shell Programming and Scripting
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)
Discussion started by: chrispward
4 Replies
4. Shell Programming and Scripting
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)
Discussion started by: chetan.c
21 Replies
5. Shell Programming and Scripting
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)
Discussion started by: dchoudhury
4 Replies
6. Shell Programming and Scripting
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)
Discussion started by: nricardo
4 Replies
7. AIX
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)
Discussion started by: rainbow_bean
1 Replies
8. Shell Programming and Scripting
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)
Discussion started by: naftali
4 Replies
9. Shell Programming and Scripting
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)
Discussion started by: tomislav91
8 Replies
10. UNIX for Beginners Questions & Answers
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 DEBIAN
app::cmd::simple
App::Cmd::Simple(3pm) User Contributed Perl Documentation App::Cmd::Simple(3pm)
NAME
App::Cmd::Simple - a helper for building one-command App::Cmd applications
VERSION
version 0.318
SYNOPSIS
in simplecmd:
use YourApp::Cmd;
Your::Cmd->run;
in YourApp/Cmd.pm:
package YourApp::Cmd;
use base qw(App::Cmd::Simple);
sub opt_spec {
return (
[ "blortex|X", "use the blortex algorithm" ],
[ "recheck|r", "recheck all results" ],
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
# no args allowed but options!
$self->usage_error("No args allowed") if @$args;
}
sub execute {
my ($self, $opt, $args) = @_;
my $result = $opt->{blortex} ? blortex() : blort();
recheck($result) if $opt->{recheck};
print $result;
}
and, finally, at the command line:
knight!rjbs$ simplecmd --recheck
All blorts successful.
SUBCLASSING
When writing a subclass of App::Cmd:Simple, there are only a few methods that you might want to implement. They behave just like the same-
named methods in App::Cmd.
opt_spec
This method should be overridden to provide option specifications. (This is list of arguments passed to "describe_options" from
Getopt::Long::Descriptive, after the first.)
If not overridden, it returns an empty list.
validate_args
$cmd->validate_args(\%opt, @args);
This method is passed a hashref of command line options (as processed by Getopt::Long::Descriptive) and an arrayref of leftover arguments.
It may throw an exception (preferably by calling "usage_error") if they are invalid, or it may do nothing to allow processing to continue.
execute
Your::App::Cmd::Simple->execute(\%opt, @args);
This method does whatever it is the command should do! It is passed a hash reference of the parsed command-line options and an array
reference of left over arguments.
WARNINGS
This should be considered experimental! Although it is probably not going to change much, don't build your business model around it yet,
okay?
App::Cmd::Simple is not rich in black magic, but it does do some somewhat gnarly things to make an App::Cmd::Simple look as much like an
App::Cmd::Command as possible. This means that you can't deviate too much from the sort of thing shown in the synopsis as you might like.
If you're doing something other than writing a fairly simple command, and you want to screw around with the App::Cmd-iness of your program,
Simple might not be the best choice.
One specific warning... if you are writing a program with the App::Cmd::Simple class embedded in it, you must call import on the class.
That's how things work. You can just do this:
YourApp::Cmd->import->run;
AUTHOR
Ricardo Signes <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-05 App::Cmd::Simple(3pm)