Sponsored Content
Full Discussion: Calling commands with ksh
Top Forums UNIX for Dummies Questions & Answers Calling commands with ksh Post 302528110 by Corona688 on Monday 6th of June 2011 12:16:25 PM
Old 06-06-2011
Quote:
Originally Posted by krishnaux
Hi,

I am not able to run below command on linux, it however works on solaris. If anyone knows the reason and a solution for it can you please let me know ?
Most shells expect to be given filenames when run in that fashion. The -c option tells it to run the following as literal script content. Try ksh -c 'echo hi'. Hopefully that should work fine on both.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl calling unix system commands

if ( system ("/bin/cat $File1 >> $File2") ) { print("#WARNING RAISED : /bin/cat File1 >> File2 - FAILURE!\n"); } I came across this code, would appreciate if someone can tell me if my understanding is correct? the perl code tell the system to cat file 1 into file 2, if command fails, print... (4 Replies)
Discussion started by: new2ss
4 Replies

2. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies

3. Shell Programming and Scripting

Calling GDB commands from Shell

Hi, I have just started off with the shell programming. I need to execute a GDB command from a shell script. I have been trying to get this working from quite sometime but not getting it quite right.I have this specific requirement that i read byte data from a file and write that data to the... (0 Replies)
Discussion started by: jsantosh
0 Replies

4. Programming

calling UNIX commands C/C++

hi Guys, I am planning to write a program which can be able to execute scripts/commands which needs a user to be root. Note: we are not interested to use sudoers option. .e.g. The requirement can be explaind as: A normal UNIX system user cannot execute above command(veritas cluster... (3 Replies)
Discussion started by: Asteroid
3 Replies

5. Shell Programming and Scripting

calling two procedures from one ksh ???

Hi to all, This is first posting in this forum. I quite new to this KSH....i guess i ll have some fun...:) Well, I have two indivdual korn shell scripts. i m calling PL/SQL stored procedure from korn shell script. It works absolutely fine. Once its completed the log is updated and data is... (5 Replies)
Discussion started by: shashi369
5 Replies

6. Shell Programming and Scripting

calling jar file from ksh

Hi, I have a below command in ksh .... $JAVA_HOME/bin/java -cp "/usr/orabase/product/10.2.0/lib:/usr/java/javajar/common/sched.jar:/usr/orabase/product/10.2.0/jdbc/lib/ojdbc14_g.jar:/usr/orabase/product/10.2.0/jdbc/lib/classes12.jar" com.abrt.smart.Smart I want to know where the... (1 Reply)
Discussion started by: PRKS
1 Replies

7. Shell Programming and Scripting

Calling Function in KSH

I have a script with 2 functions 1) show_menu 2) create Ths show_menu function works fine....... Sort of.... When I select option 2 of the menu the code does a few commands and then calls another function called create. It's at this point that I get "create: not found"..... However,... (2 Replies)
Discussion started by: hxman
2 Replies

8. UNIX for Advanced & Expert Users

Oracle (11gr2) calling unix commands (aix)

I have an Oracle database running on AIX, and I have a procedure that is calling OS commands from an oracle (and it's not working anymore)... so, there was an Java stored proc in Oracle CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED COMMON."Host" as import java.io.*; public class Host {... (1 Reply)
Discussion started by: bongo
1 Replies

9. Shell Programming and Scripting

calling perl commands in shell

i have four commands 1. perl -MCPAN -e shell 2. o conf prerequisites_policy follow 3. o conf commit 4. exit I am attempting to streamline a bunch of yum commands and cpan installations and want to remove the confirmation portion of the cpan these four commands will do just that. my... (2 Replies)
Discussion started by: murphybr
2 Replies

10. UNIX for Beginners Questions & Answers

Calling subscript with sh vs. ksh

I ran into an issue today that I was able to resolve, but I don't quite understand why the resolution worked. I'm wondering if anyone can help me make sense of it. I have a "kicker" script that calls 4 subscripts on a RHEL 6.9 server. It calls the scripts in sequence checking for a 0 exit code... (5 Replies)
Discussion started by: derndingle
5 Replies
SHELL-QUOTE(1p) 					User Contributed Perl Documentation					   SHELL-QUOTE(1p)

NAME
shell-quote - quote arguments for safe use, unmodified in a shell command SYNOPSIS
shell-quote [switch]... arg... DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands or files with embedded white space or shell globbing characters safely. Here are a few examples. EXAMPLES
ssh preserving args When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and passes them to "$SHELL -c". This doesn't work as intended: ssh host touch 'hi there' # fails It creates 2 files, hi and there. Instead, do this: cmd=`shell-quote touch 'hi there'` ssh host "$cmd" This gives you just 1 file, hi there. process find output It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote: eval set -- `find -type f -print0 | xargs -0 shell-quote --` debug shell scripts shell-quote is better than echo for debugging shell scripts. debug() { [ -z "$debug" ] || shell-quote "debug:" "$@" } With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can. save a command for later shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are things the user can't pass through), you can do something like this: user_switches= while [ $# != 0 ] do case x$1 in x--pass-through) [ $# -gt 1 ] || die "need an argument for $1" user_switches="$user_switches "`shell-quote -- "$2"` shift;; # process other switches esac shift done # later eval "shell-quote some-command $user_switches my args" OPTIONS
--debug Turn debugging on. --help Show the usage message and die. --version Show the version number and exit. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)
All times are GMT -4. The time now is 11:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy