Sponsored Content
Top Forums Programming C shell deciphers someones code & argv Post 302499941 by carbuncle11 on Friday 25th of February 2011 06:18:07 PM
Old 02-25-2011
Question C shell deciphers someones code & argv

I’m trying to work off of someone else code they gave me as an example but they are gone! I’m trying to pretty much write a wrapper of several different scripts.
They use argv[1]…I keep on thinking the next one should be argv[2] ect. I’m not sure if maybe its different in PERL maybe if that’s true? Or maybe the command lines are mutually exclusive? Then in my perl script a lot of my options are optional. I couldn’t do an if statement b/c I’m not sure which ones will be called! I almost need to append to the command file if they are selected. But I don’t think doing something like
Code:
$perl >> -lnf $lnf  would work? Do u have any idea?

set arg=$argv[1]
  shift argv
  switch ($arg)
   case "-alf":
      set dir = `echo "$argv[1]"`
    breaksw
    case "-cell":
      set cell = `echo "$argv[1]"`
      set perl = ${WARD}/bin/lnf2alf.pl -cell $cell
    breaksw
    case "-o":
      set out = `echo "$argv[1]"`
      $perl >> -o $out
    breaksw
    case "-lnf":
      set lnf = `echo "$argv[1]"`
      $perl >> -lnf $lnf
    breaksw
      case -h:
   case --help:
    default:
    goto help
    breaksw
  endsw
  shift argv
end

${WARD}/bin/lnf2alf.pl -cell $cell


Last edited by fpmurphy; 02-25-2011 at 09:43 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

any hackers? i need someones help

to get into an telephone account online :confused: (4 Replies)
Discussion started by: jackie8
4 Replies

2. Shell Programming and Scripting

Shell Script to display function names (called & defined) in a C++ Source Code

Hello to all, I am looking for a way to display only the names of function (calls & definition) of a C++ source code.There is already a post related to this, but the script is to find the functions using a specific variable, and the replies are not that convincing since they cannot be used for... (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Programming

tcl-argv with switch & while

I was trying to deciper someone else code. I'm just learning tcl. I was a litte confused about the $argv. I was thinking it would be only a certain value in argv..but if say someone give the switch -cell and -path_to_ezqb is it right to have the second one $argv??? while ($#argv > 0) ... (2 Replies)
Discussion started by: carbuncle11
2 Replies

4. Shell Programming and Scripting

Problem with call of Java Programm & return code handling & output to several streams.

Hello Everybody, thanks in advance for spending some time in my problem. My problem is this: I want to call a java-Programm out of my shell skript, check if die return code is right, and split the output to the normal output and into a file. The following code doesn't work right, because in... (2 Replies)
Discussion started by: danifunny
2 Replies

5. Shell Programming and Scripting

argv usage in a korn shell script

I'm trying to count and display the variables on a command line #!/bin/ksh $# argv from command line: tryit2 this is a test returns : tryit2: 4: not found. (1 Reply)
Discussion started by: Bperl1967
1 Replies

6. UNIX for Advanced & Expert Users

O argv, argv, wherefore art thou argv?

All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address). I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Discussion started by: alister
9 Replies

7. UNIX for Dummies Questions & Answers

Implement the '&&' function in a shell

Hello, I'm currently implementing the && function in a shell using C. For example, if we input cmd1 && cmd2, then cmd2 executes only when cmd1 exits successfully. I'm thinking about: int main() { int i; char **args; while(1) { printf("yongfeng's shell:~$ "); args =... (5 Replies)
Discussion started by: Yongfeng
5 Replies

8. Shell Programming and Scripting

Argv not found (script shell)

I don't know whether it is possible that I ask for help concerning a shel sscript that i wrote and which is not working. So here is my shell script: #! /bin/bash if($#argv != 1) then echo "hoge" exit endif set tgtdir = ../../result set target = ${tgtdir}/s${argv}/1 set... (7 Replies)
Discussion started by: khaoula.youssef
7 Replies

9. Shell Programming and Scripting

Passing Username & password through shell script to java code

Hi, I have a shell script (script.sh) in which we are calling java code which asks for Username: Password: for authentication purpose currently we are passing the credential manually and run the script. but I am trying echo -e "user_id\npassword" | script.sh but its not... (1 Reply)
Discussion started by: rakeshtomar82
1 Replies

10. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy