Sponsored Content
Top Forums Shell Programming and Scripting Why we use -f while executing any shell script? Post 302894112 by SriniShoo on Monday 24th of March 2014 04:17:37 AM
Old 03-24-2014
The script abcd.sh could be accepting named parameters and hence you are using '-f' to specify the following argument is a file / something else...that should be known once you go through the abcd.sh script
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Shell script is not executing

Hi, I am trying to execute the below shell script: script name(ss1). ss1 was given permission - 744 before executing. name: ss1 #ss1 #usage:ss1 ls who pwd :wq I tried to execute $ss1 (Enter) Its not executing.... It says that ss1 is not found: echo $SHELL. The o/put i got is... (5 Replies)
Discussion started by: dreams5617
5 Replies

2. UNIX for Dummies Questions & Answers

Executing a Shell Script

I am trying to run a shell script using the ./<ScriptName> command, but the server returns an error bash: ./Script1.sh: Permission denied What variable do I need to set to avoid this? (4 Replies)
Discussion started by: igandu
4 Replies

3. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

4. Programming

Executing shell script from PLSQL

Hi All, I have a requirement to mv a file in unix from plsql procedure. for that i have created a java host procedure, a host_command, given all grants as per ORACLE-BASE - Oracle8i Shell Commands From PL/SQL but i am getting an error ""Process err :/bin/sh: mv Not Found"" kindly let me... (1 Reply)
Discussion started by: aryan_styles
1 Replies

5. Shell Programming and Scripting

Executing shell script files

Whats the difference between executing a file such as test.sh as: ./test.sh as apposed to sh test.sh i've noticed that a simple while loop will not execute for the 2nd way of doing it, but will for the first. Also what do you guys all recom (6 Replies)
Discussion started by: linuxkid
6 Replies

6. Shell Programming and Scripting

Executing Procedure from shell script..

Hello, I created a sql file to create a Procedure, and it was successfully created. I created a sql file to execute the procedure, and it did without any errors, but i dont see the data been updated. The Execute procedure.sql script is: BEGIN set serveroutput on size 1000000 execute... (5 Replies)
Discussion started by: msrahman
5 Replies

7. Shell Programming and Scripting

Executing a shell script

LD_LIBRARY_PATH=~/tme-0.8/bus/multibus:~/tme-0.8/bus/sbus:~/tme-0.8/dist/softfloat/softfloat/bits32:~/tme-0.8/dist/softfloat/softfloat/bits64:~/tme-0.8/generic:~/tme-0.8/host/bsd:~/tme-0.8/host/gtk:~/tme-0.8/host/posix:~/tme-0.8/ic:~/tme-0.8/ic/ieee754:~/tme-0.8/ic/m68k:~/tme-0.8/ic/sparc:~/tme-0.8/... (1 Reply)
Discussion started by: lucky7456969
1 Replies

8. Shell Programming and Scripting

Executing a shell script using sh

Platform : Solaris 10, RHEL 5.4, OEL 6 I've noticed that some of my colleagues execute scripts by typing sh before the script name sh myscript.shI always execute a script by typing the script name and typing enter provided PATH variable has . (current directory) in it myscript.sh (and... (1 Reply)
Discussion started by: John K
1 Replies

9. Shell Programming and Scripting

Executing shell script from desktop

Hello All, Is there a way that I can have wrapper place in my desktop and when I run it, it connect with my server and do the action. If this can happen, Can I know how to get started Thanks (3 Replies)
Discussion started by: mirwasim
3 Replies

10. Shell Programming and Scripting

Error while executing the shell script

Hi Gurus, The following script fails with the error 'command not found' while trying to execute. As the error indicates, the script fails at ROW#30 where the EOF is defined for SQL statement. It appears that the script is trying execute the lines in the SQL output written to ta spool file.... (7 Replies)
Discussion started by: svajhala
7 Replies
Simple(3)						User Contributed Perl Documentation						 Simple(3)

NAME
Mac::OSA::Simple - Simple access to Mac::OSA SYNOPSIS
#!perl -wl use Mac::OSA::Simple; osa_script('LAND', <<'EOS'); dialog.getInt ("Duration?",@examples.duration); dialog.getInt ("Amplitude?",@examples.amplitude); dialog.getInt ("Frequency?",@examples.frequency); speaker.sound (examples.duration, examples.amplitude, examples.frequency) EOS print frontier('clock.now()'); applescript('beep 3'); DESCRIPTION
You can access scripting components via the tied hash %ScriptComponents which is automatically exported. Components are only opened if they have not been already, and are closed when the program exits. It is normally not necessary to use this hash, as it is accessed internally when needed. Also usually not necessary, but possibly useful, are all the functions and constants from Mac::OSA, available with the EXPORT_TAG "all". NOTE: Examples below show use of $^E. On Mac OS, this will return the signed Mac OS error number in numeric context, and the Mac OS error message in string context. But on Mac OS X, $^E support is unimplemented. $! and $^E will both return the unsigned error number. You can get the correct error number by adding 0 (such as "$! + 0"), and you can use Mac::Errors to get the error text (this will also work under Mac OS): use Mac::Errors '$MacError'; my $res = FSpOpenResFile($file, 0) or die $MacError; See Mac::Errors on the CPAN for more information. Functions The following functions are automatically exported. osa_script(SCRIPTCOMPONENT, SCRIPTTEXT) Compiles and executes SCRIPTTEXT, using four-char SCRIPTCOMPONENT. Component is opened and closed behind the scenes, and SCRIPTTEXT is compiled, executed, and disposed of behind the scenes. If the script returns data, the function returns the data, else it returns 1 or undef on failure. applescript(SCRIPTTEXT) frontier(SCRIPTTEXT) Same thing as "osa_script" with SCRIPTCOMPONENT already set ('ascr' for AppleScript, 'LAND' for Frontier). compile_osa_script(SCRIPTCOMPONENT, SCRIPTTEXT) Compiles script as "osa_script" above, but does not execute it. Returns Mac::OSA::Simple object. See "Methods" for more information. compile_applescript(SCRIPTTEXT) compile_frontier(SCRIPTTEXT) Same thing as "compile_osa_script" with SCRIPTCOMPONENT already set. load_osa_script(HANDLE) load_osa_script(FILE [, RESOURCEID]) In the first form, load compiled OSA script using data in Handle (same data as returned by "compiled" method; see Mac::Memory). In the second form, gets script from FILE using RESOURCEID (which is 128 by default). Returns Mac::OSA::Simple object. NOTE: Because of a change in the parameters for this function, a RESOURCEID value of 1 will not be recognized as a resource ID (the old parameter list had a value of 1 mean "load from file"). If you need to use a resource ID of 1, pass it in as both the second and third parameter. Sorry. Why would you use 1 for a resource ID, anyway?? Example: use Mac::OSA::Simple qw(:all); use Mac::Resources; $res = FSpOpenResFile($file, 0) or die $^E; $scpt = Get1Resource(kOSAScriptResourceType, 128) or die $^E; $osa = load_osa_script($scpt); $osa->execute; CloseResFile($res); Same thing: use Mac::OSA::Simple; $osa = load_osa_script($file); $osa->execute; Another example: use Mac::OSA::Simple; $osa1 = compile_applescript('return "foo"'); print $osa1->execute; # make copy of script in $osa1 and execute it $osa2 = load_osa_script($osa1->compiled); print $osa2->execute; See "Methods" for more information. Methods This section describes methods for use on objects returned by "compile_osa_script" and its related functions and "load_osa_script". compiled Returns a Handle containing the raw compiled form of the script (see Mac::Memory). dispose Disposes of OSA script. Done automatically if not called explicitly. execute Executes script. Can be executed more than once. call(CLASS, EVENT, ARGS, MODE) Calls a handler in the script, identified by CLASS and EVENT IDs. Can be executed more than once. ARGS can be either a scalar or an arrayref. MODE can be any combination of modes from Mac::OSA listed under the "Mode flags" constants. Here is an example script: on xC7event abcd1234ExC8 (filename) tell app "Finder" return [URL of file filename, creator type of file filename] end end "abcd" is the CLASS ID, and "1234" is the EVENT ID. They can be anything, as long as they don't conflict with something else. The characters xC7 and xC8 can be literal if in the Mac Roman charset, otherwise just use the values like above. Parameters are passed to handlers as named values, like "(filename)". Multiple parameters can be passed as an arrayref in ARGS, and a list of values is returned: my $script = load_osa_script($path_to_script); my($url, $creator) = $script->call(qw[abcd 1234], "my file"); You must pass in the same number of variables in ARGS that are expected by the handler. save(FILE [, ID [, NAME]]) Saves script in FILE with ID and NAME. ID defaults to 128, NAME defaults to "MacPerl Script". DANGEROUS! Will overwrite existing resource or file! Saves to the data fork instead on Mac OS X, unless an ID is provided. The context used to load a script from disk (resource fork vs. data fork, resource file vs. data file) will be used to save the script back, if applicable, so the file's format will be preserved. source Returns text of script source, if available. Script Context Scripts compiled by this module now compile scripts as script contexts, which, in part, means they can maintain state information. For example: use Mac::OSA::Simple; my $script = compile_applescript(<<'SCRIPT') or die $^E; property foo: 20 set foo to foo + 1 SCRIPT print $script->execute, " " for 0..2; Returns: 21 22 23 Whereas in previous versions of this module, it would have returned: 21 21 21 For a script that on disk, to maintain state information in the saved version, remember to call "$script-"save(LIST)>. TODO
Work on error handling. We don't want to die when a toolbox function fails. We'd rather return undef and have the user check $^E. Should "frontier" and/or "osa_script('LAND', $script)" launch Frontier if it is not running? Add "run_osa_script", which could take script data in a Handle or a path to a script (as with "load_osa_script". Should "save" have optional parameter for overwriting resource? Should "run_osa_script" and "execute" take arguments? If so, how? AUTHOR
Chris Nandor <pudge@pobox.com>, http://pudge.net/ Copyright (c) 1998-2003 Chris Nandor. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Mac::OSA, Mac::AppleEvents, Mac::AppleEvents::Simple, macperlcat. perl v5.18.2 2005-06-01 Simple(3)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy