General :: Passing Parameters To Script ?
Mar 13, 2010
I have the following bash script:
Code:
Which has the name 'extractemails.sh' and works just fine.
However, i whish to be able to give the url (or any other url) as a parameter when i run the script like this: $ extractemails.sh [url]
What should i change in my code? i have never tried passing parameters to scripts before.
View 4 Replies
ADVERTISEMENT
Apr 26, 2010
Ive read a few books and a lot of tutorials on C but can't find this topic explained in a deliberate way.I can find bits and pieces but nothing thorough.
View 9 Replies
View Related
Sep 8, 2010
I have installed grub2 on a flash drive to boot some os's that I want to carry around. But in grub.cfg when i put this:
Code: menuentry "BackTrack Persistent" {
set gfxpayload=1024x768
linux/backtrack/boot/vmlinuz BOOT=casper boot=casper persistent rw quiet
initrd/backtrack/boot/initrd.gz
} it does exactaly the same thing as this
[Code]....
I'm thinking of filing a bug report but I want to make sure i'm not doing something wrong first.
View 4 Replies
View Related
Apr 16, 2011
I get no print to stdout on screen from the C code.Does bash somehow block or mask it?I get print from bash. I get this error in the non-test bash script like: let "rdval = $rdstr"syntax error: operand expected (error token is " ")The let command prints rdval= but I presume this is due to the printf test statements getting in the way.I am getting no compile errors. Why does the C code not print the values specified?
View 2 Replies
View Related
Jan 17, 2010
I have the following problem. I have my script /usr/lib/cgi-bin/login.cgiand two page in /var/www, home.html and welcome.html.When I log in /var/www/home.html with email and password, then login.cgi to extract exact user informations from mysql. Now I'd like start welcome.html page from login.cgi and passing user informations trought parameters
View 4 Replies
View Related
Jan 12, 2011
How to use CHMOD in linux? When I try to delete a file/folder, permission is denied. What exact params must I give for chmod here? This is what I need to do. Execute a command ./build.mips , but I get permission denied error.
kirti@sgf:/disk/go$./build.mips
-bash: ./build.mips: Permission denied
View 3 Replies
View Related
Jan 8, 2011
I am new to bash scripting. I want to know whether i can pass one variable to another. For example $1 represent argument1. Now if i want to get the argument 1 like USER="1" now i want $ of $USER to execute $1 so what should i do..
View 2 Replies
View Related
Mar 21, 2011
I've a script that it's invoked with n-variable parameters. Here's an examples:
Code:
./myprogram.sh inputdir FIELD1 FIELD2 ... FIELDN outputfile In the script I would like to get the FIELD names that were passed.
View 4 Replies
View Related
Mar 6, 2011
the problem is i am changing the parameters in main.cf file but postfix is not accepting them. its still inheriting my system's host name and domain
here is my configuration
my main.cf file
myhostname = mail.example.com
mydomain = example.com
myorigin = $domain
[Code].....
Nothing is accepted. I have test this on CentOS 5.5 and Fedora 14 both have the same result.
View 3 Replies
View Related
Dec 21, 2010
I am reading a tool manual and it instructs to use such a command:
Code:
Especially, what does the 'sort' parameters and awk do?
View 8 Replies
View Related
Jan 21, 2010
In short: how to make sudo not to flush PATH everytime?
I have some websites deployed on my server (Debian testing) written with Ruby on Rails. I use Mongrel+Nginx to host them, but there is one problem that comes when I need to restart Mongrel (e.g. after making some changes).
All sites are checked in VCS (git, but it is not important) and have owner and group set to my user, whereas Mongrel runs under the, huh, mongrel user that is severely restricted in it's rights. So Mongrel must be started under root (it can automatically change UID) or mongrel.
To manage mongrel I use mongrel_cluster gem because it allows starting or stopping any amount of Mongrel servers with just one command. But it needs the directory /var/lib/gems/1.8/bin to be in PATH: this is not enough to start it with absolute path.
Modifying PATH in root .bashrc changed nothing, tweaking sudo's env_reset and env_keep didn't either.
So the question: how to add a directory to PATH or keep user's PATH in sudo?
Update: some examples
$ env | grep PATH
PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/var/lib/gems/1.8/bin
$ sudo cat /etc/sudoers | egrep -v '^$|^#'
Defaults env_keep = "PATH"
[Code]....
View 4 Replies
View Related
Nov 18, 2009
I'm using gdb to debug my program. My program requires arguments (e.g., ./prog -dfile).But if I use gdb as in gdb ./prog -dfile, gdb wants to interpret the -d argument. How do I pass an argument to my program via gdb?
View 2 Replies
View Related
Mar 31, 2011
So I'm trying to teach myself to write programs for unix in c. I am currently creating a program, and I need to pass a struct through a socket
The struct I want to pass has two types in it, one enum and one union of two other structs. These two other structs each contain an int and a char variablename[256] array.
gcc won't let me just pass the struct using write(pipefd[1], struct, size_of_struct) since the struct is not a char buffer. So that's my question...how does one go about passing a struct?
View 1 Replies
View Related
Jun 29, 2010
I'm trying to download two sites for inclusion on a CD:URL...The problem I'm having is that these are both wikis. So when downloading with e.g.:wget -r -k -np -nv -R jpg,jpeg, gif,png, tif URL..Does somebody know a way to get around this?
View 2 Replies
View Related
Sep 18, 2011
I have made a script ocrun param1 param2 that calls another program like oprun param1 ..
i would like somehow param3 and all following (parami) to be copied to oprun.. ex:
`ocrun param1 param2 param3 param4
`oprun param1` param3 param4
How can i achieve this ?
View 1 Replies
View Related
Feb 11, 2010
This is a WHAT I WANTAND NEED IN A LINUX DISTRO, not a your preference request. Fairly literate with Windows XP, but would like to find a Linux Distro with specific features. Computer used for music (over 14k mp3, ogg Vorbis, etc files) and burning musical learning tracks (I'm a barbershopper) as well as simple surfing and email. Not a gamer. Older Computer: PC with 1.4 GHz Athlon partitioned 320 Gig HD (Windows XP and a Linux Distro??) Only have CD-ROM, cannot download & burn iso DVD's or upload from them. (Can do CD's) Do have a 1 TG Verbatum external HD and a newer computer with a dvd recorder/player
So:
1) MUSTt have a distro that doesn't require a DVD for installation.
2)MUST be able to "update" rather than re-install subsequent releases ( which require backing up files, etc)
3) Like the description of Linux Mint Helena, but it requires installation from a DVD and a re-install..
4) Free distro since I'm learning and trying out different OS's and really resent the increasing cost of Windows OS's as well as the complexity and problems with Windows. I've found that UBUNTU 9.10 doesn't like me. I am very comfortable with LINUX MINT HELENA.
View 5 Replies
View Related
Nov 16, 2010
We just doubled the RAM on our RHEL 4 production servers...Oracle from 16gb to 32gb and Apache/JBoss from 8 to 32 gb. I am trying to figure out how to get the biggest bang from the increased RAM. Should kernel.shmmax be upped to be 50% of the 32gb....from its current 8gb? I need to create the largest possible SGA and was unable to do so, apparently because the kernel.shmmax value had gone unchanged.
And for the JBoss web servers, also RHEL 4, and particular kernel changes which can take advantage of the increased RAM and provide an immediate performance improvement?
View 7 Replies
View Related
Aug 11, 2010
I want to install Mint 9 KDE but I need to specify some installation parameters. I need to set the default filesystem as EXT3 so I can create a disk image with Acronis True Image that doesn't support EXT4 yet.
I've done the same with Ubuntu Server 10.04 by including the parameter 'partman/default_filesystem=ext3' at the installation console. I know Mint 9 Gnome can also be installed direct from the CD, but the KDE Live DVD doesn't give me any such option - just the desktop installer.
How do I customise the installation of Mint 9 KDE?
View 2 Replies
View Related
Jun 16, 2011
Why does this work
Code:
for myfile in `find . -name "R*VER" -mtime +1`
do
[code]...
View 2 Replies
View Related
Jul 31, 2011
is there any way I can pass commands to the CLI of a tool directly?
I would like to script some actions, for example:
./OpenBTS < "tmsis"
I do not need to retrieve the results (I watch it in the log file). how I could realize that? There is now way to do this using command line parameters, at least not that I found out. So it looks like I have to figure out sth myself. Maybe I could automate screen in a way to detect the prompt and "paste" my command there. Are there tools for this on Linux?
View 3 Replies
View Related
Aug 4, 2010
I am writing a script to get hardware information of a particular UNIX machine. To do this, I ftp a shell script (commands to get h/w information) to the target machine and then use SSH to remote the remote script.With FTP, I can pass a password accepted as input the shell script. How can I pass the same password to SSH ? This is because I do not want the user to enter the password twice.
View 5 Replies
View Related
Mar 17, 2011
I'm trying to do substitutions to a file based on passed variables.
For example, I have a file called test.txt that has 5 lines:
What I want to do is to go through that file, line by line and check for the presence of a passed variable in that line. If I have a match, then substitute and print, otherwise print line as is. My problem arises in that the number of variables is well, variable.
The code I started with was the following:
Code:
What I was hoping for was test.out to look like this:
What I get is a much longer file like this:
This makes sense after thinking about it but is there anyway to get an output like the first case?
View 5 Replies
View Related
May 12, 2011
Simple question: what parameters can be used to shutdown a computer running Linux/OSX in 30 seconds? I've always run Windows, where I would go shutdown -s -t 30 but the parameters are different. I've looked it up here but it will only let you shut a computer down at a specific time (like 8:00) rather than in a specific amount of seconds.
View 4 Replies
View Related
Aug 12, 2011
I've accidentaly corrupted my fstab and cut the ends of lines. There are now disk uid, mount point, filesystem for root and swap, but the mount parameters are missing.The system boots as readonly. What are default fstab mount parameters in Debian for ext4 root and swap?
View 1 Replies
View Related
Jan 7, 2011
I hope to add a wrapper script for the command with different parameters. For example, for any Unix command or script, like below:
command.sh -s p1 -o p2 -q p3
or
command.sh
Probably we could do as this way
cat wrapper
$1 $2 $3 $4 $5 $6 $7 | tee test.log
(assume it has 0 to 6 parameters)
and use it like
wrapper command.sh -s p1 -o p2 -q p3
wrapper command.sh
It is a little ugly to list all fixed parameter as above, do we have better code to handle various parameters?
View 4 Replies
View Related
Feb 2, 2010
I have a generic monitor which has problems with many Linux distros. We can boos Sugar on a Stick v2 by pressing <tab> at the Sugar splash screen and adding the boot parameter "nomodeset". I'm handy enough to do this, but my wife, well, not so much. So is there a way to make that boot parameter permanent?
View 1 Replies
View Related
Nov 3, 2009
what I am trying to do but I am not sure exactly how to do it. I want to write a shell script that will replace certain values in a file with environment specific information that it pulls from a parameters file. The paramaters file looks like the following...
[dev]
ip=10.15.109.41
name=dev1.mydomain.com
[code]...
View 4 Replies
View Related
Mar 20, 2011
Some programs will take options like this:$ someprogram -orange apple
And other programs will use something like this:
$ otherprogram --orange apple
Is there a "rule" or convention for this in Linux/Unix/OSX?
View 2 Replies
View Related
Apr 2, 2011
how to pass an array as a command line argument in a shell script?
View 5 Replies
View Related
Dec 11, 2010
The script receives multiple files as parameters and it is supposed to count the number of lines in each of them and write that number in another file.
This is my script:
Code:
while [ -n "$1" ]
do
lines=`cat $1 | wc -l`
echo "The number of lines in file $1 is $lines." >> lines.txt
shift
done
Is there any other way to do the same thing, without using shift?
View 7 Replies
View Related