In this situation, I probably wouldn't even bother with getopts.
If you only want to install 1, 2, or 3 packages (thus assuming that the ONLY action that the script is to perform is to install packages) you could do the following:
Now... I haven't checked this out - just wrote it on the fly. But you get the idea......
What is the maximum no. of arguments that could be passed to a shell script ? Is there any restriction ?
I've a requirement where I need to pass a list of names to a unix script and I guess the number of such names is not a fixed one. It can run into hundreds.
Is this feasible ? (4 Replies)
Hi,
I have a shell script called ftp.sh which is running continously in background.
I tried passing arguments to this script but it did not worked out.
Below is ftp.sh script. Please help me
case $param in
start) sleep_func "300"
echo "!ksh $scr_ddir/ftp.sh... (1 Reply)
Hi,
I have a function in shell script
fun1{ echo "No.of arguments are..."}
this function will be called in same script by passing arguments
fun 1 2 3
I want to check the no. of arguments passed to fun1 function in the same functionbefore validation.
can any one suggest me. (2 Replies)
Here is my script:
#!/bin/ksh
usage ()
{
echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>"
}
if ; then
usage
exit;
fi
prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log
I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Hello,
I have to make a shell script doing that :
the program tests if there is an argument, if there is it checks whether this is a directory or not, If it is it opens it.
for any .c file in the directory it prints 2 lines in the screen :
the dependence line of the .o and compiler commend... (1 Reply)
Hi,
I have a shell script, when run it i get a prompt to enter arguments say 1 for doing my next task otherwise q for quit.
What I am trying to do is run the shell script with the argument passed in however it does not seem to work.
This is what I did
./test.sh 1
Instead it printed the line... (6 Replies)
I need to run a local shell script on a remote machine. I am able to achieve that by executing the command
> ssh -qtt user@host < test.sh
However, when I try to pass arguments to test.sh it fails.
Any pointers would be appreciated. (7 Replies)
My requirement is that I want to pass similar argument to a shell script and process it in the script. Something like below:
myScript.sh -c COMPONENT1 -c COMPONENT2 -a APPNote: -c option can be specified multiple times and -a is optional parameter
I know this can be achieved using... (2 Replies)
Hi all,
I am working on a project, in which I have to connect to Bluetooth low energy device. I am able to connect and do data transfer from command line. But I want to do from script
Here is my script
#!/bin/bash
#sudo hcitool -i hci0 lescan
sleep 1
sudo hcitool -i hci0 lecc --random... (8 Replies)
Hello,
I have a simple shell script, which starts from crontab like this:
00 03 * * 2-6 /export/applications/dte/sh/fwmarg.sh > /export/applications/dte/data/cron_log/fwmarg.cronlog.`date +\%m.\%d` 2>&1
The script doesn't get any argument. But inside it I see the line
... (10 Replies)
Discussion started by: digioleg54
10 Replies
LEARN ABOUT DEBIAN
rinse
RINSE(8) Perl Programmers Reference Guide RINSE(8)NAME
rinse - RPM Installation Entity.
SYNOPSIS
rinse [options]
Help Options:
--help Show help information.
--manual Read the manual for this script.
--version Show the version information and exit.
Mandatory Options:
--arch Specify the architecture to install.
--directory The directory to install the distribution within.
--distribution The distribution to install.
Customization Options:
--add-pkg-list Additional packages to download and install
--after-post-install Additionally run the specified script after
the post install script.
--before-post-install Additionally run the specified script before
the post install script.
--post-install Run the given post-install script instead of the
default files in /usr/lib/rinse/$distro
Misc Options:
--cache Should we use a local cache? (Default is 1)
--cache-dir Specify the directory we should use for the cache.
--clean-cache Clean our cache of .rpm files.
--config Specify a different configuration file.
(Default is /etc/rinse/rinse.conf)
--pkgs-dir Specify a different directory containing
<distribution>.packages files.
--mirror Specify the URL of the mirror.
(Default is to read it from /etc/rinse/rinse.conf)
--list-distributions Show installable distributions.
--print-uris Only show the RPMs which should be downloaded.
default files in /usr/lib/rinse/$distro
--verbose Enable verbose output.
OPTIONS --arch Specify the architecture to install. Valid choices are 'amd64' and 'i386' only.
--add-pkg-list Add a list of additional packages.
--cache Specify whether to cache packages (1) or not (0).
--cache-dir Specify the directory we should use for the cache.
--clean-cache Remove all cached .rpm files.
--directory Specify the directory into which the distribution should be installed.
--distribution Specify the distribution to be installed.
--help Show help information.
--mirror Specify the URL of the mirror. Normally this is read from /etc/rinse/rinse.conf.
--list-distributions Show the distributions which are installable.
--manual Read the manual for this script.
--print-uris Only show the files we would download, don't actually do so.
--verbose Enable verbose output.
--version Show the version number and exit.
DESCRIPTION
rinse is a simple script which is designed to be able to install
a minimal working installation of an RPM-based distribution into
a directory.
The tool is analogous to the standard Debian GNU/Linux debootstrap
utility.
USAGE
To use this script you will need to be root. This is required
to mount /proc, run chroot, and more.
Basic usage is as simple as:
rinse --distribution fedora-core-6 --directory /tmp/test
This will download the required RPM files and unpack them into
a minimal installation of Fedora Core 6.
To see which RPM files would be downloaded, without actually
performing an installation or downloading anything, then you
may run the following:
rinse --distribution fedora-core-6 --print-uris
TODO
Short of supporting more distributions or architectures there aren't
really any outstanding issues.
AUTHOR
Steve
--
http://www.steve.org.uk/
LICENSE
Copyright (c) 2007-2010 by Steve Kemp. All rights reserved.
Copyright (c) 2011-2013 by Thomas Lange.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the
full text of the license.
2.0.1 2013-01-28 RINSE(8)