Command line parameters and Shell Script -- URGENT

Hi folks,
I am facing some problem in the Shell script and the command line parameter.
The scenario is -- I am picking a file from a directory, whose path is <b>/interfaces/xid/receive/filename.dat</b>
I have to encrypt filename.dat and move it to another folder, whose path is <b>/interfaces/xid/send</b>. So, the encrypted file will reside in the <b>send</b> directory.
Now, I don't want to hardcode the new path, where the encrypted file has to be moved. Please let me know how to achieve this. Please consider this as urgent.
Have a look at the command line in the "before message processing"  -- <b>/interfaces/xid/receive/xi_decompress.sh  /interfaces%F</b>
Have a look at the shell script for the same --
#!/bin/sh
Setup environment variables
COMMPRESS_DIR=/interfaces/software/commpress
export COMMPRESS_DIR
LOG_DIR=/interfaces/software/commpress/log/
export LOG_DIR
IN_FILE=$1
export IN_FILE
Find the directory where the unencrypted file is deposited
IN_FILE_DIR=`dirname $1`
export IN_FILE_DIR
Make sure the working directory is where the unencrypt.key is...
cd $COMMPRESS_DIR
encrypt the file
if [ `uname` = "HP-UX" ]
then
   find $IN_FILE | $COMMPRESS_DIR/compx $IN_FILE_DIR logpath=$LOG_DIR
else
   find $IN_FILE | $COMMPRESS_DIR/compx-sun $IN_FILE_DIR logpath=$LOG_DIR
fi
Get the result of the encryption
RET_CODE=$?
Check decryption result
If error (retuen code <> 0), create an error log file in the
same directory as the input file.
if [ $RET_CODE -ne 0 ]
then
    PREFIX="Decryption"
    DATE_TIME=$(date +%Y%m%d_%H%M%S%N)
    SUFFIX="err"
    FILENAME=$/$_$.$
    echo "Decryption Error log"        >$FILENAME
    echo "DATE_TIME:  $"   >>$FILENAME
    echo "DIRECTORY:  $" >>$FILENAME
    echo "FILE:       $"     >>$FILENAME
    echo "ERROR CODE: $"    >>$FILENAME
fi
exit $RET_CODE
What else I need to add in this piece of code? Urgent help !!
Thanks a lot in advance.
Neetesh

Hi Satish,
I was able to figure that out, that we need to hard code the path as the 2nd parameter.
But I guess there is a way out in Unix where we can handle this situation, where we are not willing to hard code.
Anyways, thanks a lot for your input .. -:)
Cheers,
Neetesh

Similar Messages

  • Command line parameters and resuming

    Hi,
    I am researching for a client who wishes to have several students (K-12) using Adobe Captivate course on the same computer. Another constraint is that a course is run from DVD (1+ GB in size) so it's published as standalone application (.exe for Windows, .app for Mac). Quick questions:
    Can a course have an action to parse command line parameters? I haven't found that.
    Explanation: this would be used to simply parse a name and e-mail address (if possible) and last module passed to a course player. Resuming could be disabled (there is an answer how to do that in the forum) or overridden but the learner should be transferred to a slide to resume based on the calling parameter (and not the default resuming - there will be several users so each must resume from the last passed module slide).
    Can a progress of the current learner using the course be saved to a database (no LMS, e-mail, Acrobat.com etc)?
    Explanation: this is needed for the current learner and for each one separately. I guess I already have a solution in mind (custom application, having small internal web server like Mongoose, with a script that replaces internalServerReporting.php and saves the data to a internal database, SQLite). But for this to work spawning a course with command line parameters and course itself reading these parameters would need to work.
    If there is a (better) solution for the above, please reply. The goal is have minimal changes on the course e.g. if there are command line parameters, then parse them and do something (mark modules passed, open appropriate next slide). If parameters are not given/recognized, do nothing (so the course would still work on computers used by one learner only, including resuming etc).
    My opinion is that this should also be one-way as much as possible. E.g. additional application handles user name, e-mail and current progress and spawns Captivate course. The published course itself should not depend on the application like reading progress from a text file (though an URL call could return current progress from an application for the same user name). So ideally only changes to use internal server publishing to save current progress and adding a logic to check parameters at start would be applied to a course.
    Waiting for your smart answers.
    Matt

    DVDs, when finalized, are read-only... so unless you are considering to do an Install of the course from the DVD to the machine, you're not going to be able to write to a database.  A USB stick may be more suitable in this situation.
    Command line params are not possible with EXEs unless you create your own EXE wrapper.  If you're going to go through that trouble, you'd be better off creating an Adobe Air application that can run your local web content without security restrictions and use SQLite or some other backend to store the data.
    Can the progress be saved?  It depends what you mean by progress.  If you just want to allow the student to resume from the slide where they left off... you can do that with a bit of JavaScript.  However, if you want to ensure that any previous questions answered on a quiz were also resumed and intact from the previous session... not possible without an LMS.
    Why not run a Moodle installation via a USB stick and you can have a full featured LMS with a database and ability to resume a previous session?
    http://docs.moodle.org/19/en/Installation_guide_-_Moodle_for_Windows_on_a_USB_Memory_Stick
    Just some things to consider...

  • Command-line parameters and dbxtool

    Hello, I'm trying to call dbxtool from a script in order to start a debug session. My command line is something like this:
    dbxtool -E prog -arg1 -arg2
    Where "-arg1 -arg2" are arguments accepted by prog. However dbxtool seems to be trying to process those args itself, so upon launch of dbxtool I get a dialog saying "dbxtool: unrecognized option '-arg1'".
    I don't think this is a quoting issue with my debugging script, since I get this error when simply running dbxtool as above from the command line.
    Any tips on how to pass these args in correctly?
    Thanks,
    -Jason

    I will submit a bug report, thanks for the link.
    Yes, we're using -E for legacy reasons. We have a script that sets up the environment we need, and then launches the debugger. For Studio 11 and previously we used sunstudio -E, so now with Studio 12 it seems that dbxtool is more appropriate.
    I realize that the parameters could be entered in dbxtool, but our users are accumstomed to providing them on the command-line call to our script. Having to enter them in dbxtool is seen as an extra step, retrograde, etc. It's difficult enough getting them to use Solaris over Windows as it is. ;-)
    I did notice that the dbxtool manpage mentions "If you intend to embed dbxtool in a shell script or driver program, consider using ss_attach", which sounded good, but ss_attach doesn't seem to accept parameters.

  • Command line parameters and path problem

    hello ....
    I have to execute an application from my java program. My application called "AIMSS" takes 2 command line parameters. Now, when i mention those parameters with complete path to my executeable, windows reports that "unable to open the shortcut". Below is what i am trying:
    private static final String WIN_PATH = "rundll32";
    private static final String WIN_FLAG  "url.dll,FileProtocolHandler";
    private String cmd = null;
    private String url = null;
    public void runMyFileWithMessage(String msg)
        try
    url = "C:\\Program Files\\Raytheon\\AIMSS 4.0\\Runtime\\Standard\\aimss40.exe" + " AAAVIETM 3457";
                 cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
                 System.out.println(url);
                 Runtime.getRuntime().exec(cmd);
            catch(IOException io)
                System.out.println("AIMSS problem. Below is the Stack Trace.");
                io.printStackTrace();
        }Although, when i tried to run the executeable from Start->Run, by giving it same complete path and 2 arguments, it runs fine. Any help would be greatly appreciated.
    Raheel.

    Passing multiple paramters in a String to exec() doesn't work. Use the exec method that takes a String array instead and pass the call and each parameter in as a separate String.
    Off the top of my head (check the api) it will be something like
    String[] cmd = {"C:\\Program Files\\Raytheon\\AIMSS 4.0\\Runtime\\Standard\\aimss40.exe","AAAVIETM", "3457"};
    Runtime.getRuntime().exec(cmd);

  • Command line parameters for OMBPlus?

    Hi,
    Is it possible to pass command line parameters to TCL scripts running in OMBPlus.sh, and if so, can someone provide an example?
    I'm able to use the argv0 variable to get the script name itself but not sure how to get any other additional parms...
    Thanks,
    Jim

    Jim,
    If you are building command-line scripts to automate OMB+ commands, there is another factor you should be aware of. If your script errors out cleanly, the OMBPlus.sh does NOT pass this back to the shell. The return code is evaluated within OMBPlus as the return from a "source" command and then OMBPlus exits normally.
    For example:
    #file test.tcl
    return -code error
    Unix/shell> OMBPlus.sh test.tcl
    Unix/shell> echo $?
    0What I do to pass an error state back to the shell is to create a flag file in my script if exiting due to error. My shell script deletes this file prior to running the script and then tests for it after the run as part of the conditional logic
    Function in tcl file:
    #Get location where this script installed
    #This variable is set at the top of the script.
    set theScriptDir  [ file dirname [info script]]
    #If we want to bail in the script at any point we call exit_failure with an appropriate error message
    proc exit_failure { msg } {
       global theScriptDir 
       set ERRFLAGFILE "$theScriptDir/ers_owb_import.error"
    #rollback any uncommitted work
       OMBROLLBACK
    #Log the error and exit
       set fout [open "$ERRFLAGFILE" a+]     
       puts $fout "Error:-> $msg"
       close $fout
       # return and also bail from calling function
       return -code error
    }And my shell script does something like:
    cd ${JOB_DIR}
    rm -f ers_owb_import.error 2>/dev/null
    echo \\nBegining Uninstall of OWB Project
    ./OMBPlus.sh ${JOB_DIR}/my_tcl_Script.tcl
    if [ -f ${JOB_DIR}/ers_owb_import.error ] ; then
          echo \\nERROR - SCRIPT FAILED
    else
         echo \\nScript Succeeded.
         # script logic continues....
    fiCheers,
    Mike

  • XSQL Command-Line, parameters with blanks

    Is it possible to use XSQL Command-Line with parameters containing blanks (space characters).
    In an URL parameter spaces can be encoded with "+" or "%20", but this does'nt seem to work with XSQL Command-Line parameters.
    -- Peter

    I can't make this work on Unix (solaris), but I can see it is a shell script problem, not a XSQL problem.
    The normal syntax for Unix shell script would be
    $ script.sh foo="one two"
    but the standard Oracle-supplied xsql unix shell script sets environment and passes all command-line parameters to the java program with
    oracle.xml.xsql.XSQLCommandLine $*
    and thereby the quotes disappear.
    The problem is not really big, since I could just do
    oracle.xml.xsql.XSQLCommandLine test.xsql "foo=one two"
    after setting classpath. Anyway, if anybody knows how to make the xsql script work with quoted parameters, let me know.
    -- Peter

  • MS TS RemoteApp Programs Command-line Parameters (%temp% or %appdata%)

    Hello,
    We are trying to get an in house Application published to the TS RemoteApp Programs. We are using a logon script that places the a cmd file in the users %temp% or %adddata%.  We are using this so that there is no file locks that occur.
    Then we wish to use the command-line parameter "Always use the following command-line parameters" as Local -t -c "%temp%\file.fp". However this is not successful. I have eliminated the %temp% with the temp directory path and the application
    runs correctly. 
    It looks like to me that the environmental variable is not loading. Is there something that I can do for this to get this running? 

    Hi,
    Thanks for posting in Windows Server Forum.
    As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as ‘Answered’ as the previous steps should be helpful for many similar scenarios. If the issue still persists, please feel free to 
    reply this post directly so we will be notified to follow it up.
    BTW,  we’d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems.
    Thanks for your Support & understanding.
    Regards.
    Dharmesh Solanki
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to get ALL command line parameters

    Hi,
    Is there possibility to get all command line parameters which
    Flex builder invokes when I press RUN button ?
    I am asking because I want to create mxmlc ant task with the
    same parameters as Flex builder.
    I wrote something like that below but I have a problem with
    invoking remote function, it seems that poduced SWF inf flex
    builder an my script (below) arent the same - and mayby have some
    security differences.
    Any Ideas how to get all compiler argumets from flex builder
    quote:
    <mxmlc
    file="${flex.src}\main.mxml"
    output="${flex.output}\main.swf"
    services="${path.tomcat.root.WEB}/flex/services-config.xml"
    context-root="${path.tomcat.root}"
    use-network="true"
    keep-generated-actionscript="false"
    debug="false"
    locale="en_US"
    incremental="true"
    >
    <!--load-externs="${LOADEXTERNS}"
    link-report="link-report.xml" -->
    <load-config
    filename="${FLEX_HOME}\frameworks\flex-config.xml"/>
    <source-path path-element="${FLEX_HOME}\frameworks"/>
    <compiler.source-path path-element="${flex.src}"/>
    <compiler.library-path dir="${FLEX_HOME}\frameworks"
    append="true">
    <include name="libs" />
    <include name="../bundles/{locale}" />
    </compiler.library-path>
    </mxmlc>

    Hi,
    Try -dump-config compiler argument, which will write all the
    currently set configuration values. Please find more details at the
    URL below.
    http://www.quilix.com/node/9
    Hope this helps.

  • BSM / audit_syslog ... how to get command line parameters in syslog?

    Hi All!
    I have been experimenting with Sun Basic Security Module (BSM) and was trying to send audit data via syslog to a central logging server like so:
    # cat /etc/security/audit_startup
    /usr/sbin/auditconfig -setpolicy +argv,arge
    # cat /etc/security/audit_control
    plugin: name=audit_syslog.so;p_flags=lo,ex,fr,fc,fd,fw,fmThis does produce the desired log output on the central logging server, except that the log lines do not contain command line parameters / environment variables:
    2008-10-14T15:04:26-06:00 csadm4/csadm4 audit: [ID 702911 audit.notice] execve(2) ok session 1576737601 by rem_adm as root:root in csadm4 from csadm1-16.shell.ca obj /usr/bin/lessAs this makes it pretty useless for keeping proper audit records (there is a difference between
    rm ~/file and
    rm /file that I would like to see) I was wondering if there is a way to customize what is actually produced by audit_syslog.so?
    Thanks in advance,
    Rudolf

    No, your plugin doesn't get any access to the command line.  Look for other methods of IAC (COM, DDE, shared memory, shared file, etc.)

  • How to pass command line parameters in calling ant file

    Hi All, I m using a Build file which calls another build file.
    That build file is run from the command prompt by give ant -lib <path of jars it needs for executing>.
    Now i m calling this file from main build file but it does not work as i m not able to set <b>-lib </b>.
    Pls can anybody let me know how to set such command line parameters to call the build file in ant script.
    Thanks in Advance.
    Ketan.B.Parekh

    Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
    Another option is to use external tables
    Re: Data Loading
    Message was edited by:
    Jens Petersen

  • What command line parameters will QuickTimePlayer.exe accept?

    What command line parameters will QuickTimePlayer.exe accept?
    I wish to create a shortcut that will open URL to a .mov with the QuickTime application.

    Hi,
    I found the Script at the Task schedulder /libary/ Microsoft/defrag
    There was some discussion of this topic here:
    https://social.technet.microsoft.com/Forums/windows/en-US/7fc46461-daf5-4004-b1a7-ca645e370ee5/defrag-on-ssd-the-volume-system-reserved-was-not-optimized-because-an-error-was-encountered-the?forum=w8itprogeneral
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • Command Line Parameters for spotify.exe? (Windows 7)

    I've been trying to use Windows Speech Recognition to open music. The problem is, the WSR Macros only open the executable then ask you if you want to run the program with command-line parameters. What I want to do is say the album or the artist then have Spotify open and play that artist/album; I can't do that until I figure out how to open spotify with parameters, if there are even any. Thanks for your help. (I also know how Spotify has had multiple suggestions for this to be integrated in the application itself, but I'm trying to just use Windows Speech Recog)

    Hi,
    I found the Script at the Task schedulder /libary/ Microsoft/defrag
    There was some discussion of this topic here:
    https://social.technet.microsoft.com/Forums/windows/en-US/7fc46461-daf5-4004-b1a7-ca645e370ee5/defrag-on-ssd-the-volume-system-reserved-was-not-optimized-because-an-error-was-encountered-the?forum=w8itprogeneral
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • Running a class with command line parameters from IDE

    Hi there,
    I want to run a class from with the developer IDE. But I also want to pass in some command line parameters. Is there any way to do this from within the IDE, without having to go out to a Dos Prompt or shell?
    Thanks in advance
    Johnny

    In JDeveloper 10.1.3, Project Properties->Run/Debug->Edit
    choose the program that should be be the default run target.
    Click "Tool Settings" in the left pane and then in the right pane under "Additional Runner Options" select "Allow program input".
    It works, but the input works better in the command prompt. The problem is that after entering one input the Input-line looses focus and one have to click it to re-focus. A bug?
    However, this lets me use the "Run" button. All in all, a more efficient way of developing programs.

  • Command line parameters for automator?

    I'm trying to setup a cron job to so that every morning at 8 am "New Mail.workflow" will open and run. I'm able to get it to open but I was wondering if there were command line parameters for Automator that could open AND run a workflow file? Ideally I'd like it to close after running, but I'll worry about that later. Thanks in advance.

    The preferred way is to save your workflow as an application and then call usr/bin/open on it. If for some reason you must have the workflow run inside of Automator (not self-contained) then you're looking at some quality time with man osascript. As it happens Apple has removed even the need for Cron for most users. A click to File -> Save As Plug-In -> for iCal handles it from start to finish.
    Edit: I forgot to mention that Automator has its own simple command line utility for running *.workflow files. Check out man automator

  • Command Line Parameters Nightmare!

    My issue--and it seems to only be my issue--is with the Command Line Parameters. I have been trying to install iTunes 5.0 for five days now. I have tried everything posted in these forums. Dmitry, thanks for such a great resource; it helped some, but not with this one problem, unfortunately.
    Anyway, everytime I open the iTunes installer I get a message about command line parameters. It gives me a list of a bunch of parameters that I know nothing about. If you would like to see a screen shot of this travesty, you can go to this link: http://staff.fcps.net/nfish/specialdownloadspage.htm.
    Anyone know how to fix this problem or know an alternative solution? Thanks.

    I solved my problem...Everyone who has this problem needs to go see Tim's incredible solution at Nathanael Fish, "new error......" #13, 09:55am Sep 23, 2005 CDT
    It will fix this problem, guaranteed.
    Nate

Maybe you are looking for

  • I'm trying to make more room on my phone by deleting most of my songs and just keeping a few playlists.

    But when i try to sync my phone in itunes it won't let me because i don't have enough storage left on my iphone 5!!! How do i get around this catch 22? My son has a similar problem with his iphone4, except that he deleted everything off his phone (ph

  • Multiple file types to PDF

    I have a need to combine images and documents into a single PDF. Using automator, I am able to make an application that combines selected images in the finder into a pdf, but it doesn't work on text documents. So, I found this application that adds a

  • How to Connect N800 to Blackberry 8310?

    I'm having trouble connecting a N800 tablet to my Blackberry 8310 phone to access the internet. My operator is AT&T. The N800 is able to pair with the 8310 and it's been updated to the latest OS2008 software using the Nokia Software Wizard. I've also

  • Redirect - "Search Engine Friendly"

    <% Response.Status="301 Moved Permanently"; Response.AddHeader("Location"," http://www.moreproductinfo.com/index.asp"); %> Was looking at a site that had the above code as a recommendation to add to a page to "correctly" pass on information to search

  • Converting server from Big5 to UTF8.

    I try to convert oracle 8i server from big5 to UTF8 by using "alter database character set utf8". But it tells me "ORA-12712: new character set must be a superset of old character set. Is there any way to enforce this conversion? I understand there w