My Bash-Script should accept arguments and options.
Moreover arguments and options should be passed to another script.
The second part I've solved:
for argument in "$@"; do
options $argument
done
another_script $ox $arguments
function options {
case "$1" in
-x) selection=1
-y) selection=2
-h|--help) help_message;;
-*) ox="$ox $1";;
*) arguments="$arguments $1";;
esa
I've learnt the basics of programming in bash.
What my main is supposed to do is either read from stdin using system calls. Or if file arguments are given open the file arguments. I had already coded this to read from one file argument. But now I need it to open from multiple file arguments and I am short on the logic as to how to do this.
I need to write a bash script that does the following:
If it is given fewer than two arguments, it prints an appropriate
error and exits.
At this moment I have:
#!/bin/bash
screen -p 'ScreenName' -x eval 'stuff '"'"$@"'"'\015'
echo eval 'stuff '"'"$@"'"'\015'
But when I call my script as:
# script.sh asd "asd" 'asd'
my arguments passed as: asd asd asd
and I get output:
eval stuff 'asd asd asd'\015
I except a: asd "asd" 'asd'
How I can change my script to pass whole arguments line with all quotes?
plink user@10.220.60.xx -t '/home/user/test/testpgm'
I'm able to run the below program which resides on a Linux machine from a windows machine using the above plink cmd.
#include<stdio.h>
int main(int argc,char *argv[])
{
int i;
char buf[30];
printf("Test Pgm \n");
printf("No of Arguments=%d\n",argc);
printf("Enter a string:");
fflush(stdout);
gets(buf);
printf("In
Possible Duplicate:
How do I handle switches in a shell script?
Most common shell commands allow the user to specify options in any random order. Positional Parameters like $1 as commonly used in bash (I tend to write all my scripts in Bash but I don't think this question is actually Bash specific) scripts on the other hand, are order specific.
Hello,
I wrote this simple program which prints all the arguments given to a program.
My code is straightforward and this is it
Code:
#include <stdio.h>
#include <malloc.h>
int i = 0;
int main(int argc, char** argv)
{
printf("\nargc == [%d]",argc);
printf("\nthe arguments are ");
for(i=0;i<argc;i++)
{
printf(&q
I have a tcsh script which I pass arguments to. I want to store all the arguments except for the options.
Currently I am using the line below, however I want to also exclude and variation of them (e.g.