General :: Why Does Perl Execute Bash Scripts
Mar 23, 2011
I'm playing with perl and found that I could just go:
"perl /home/me/bash_script.sh"
and it would execute, even though it's not a perl script. Is that just a feature or is there something I'm missing? Why does perl do this?
View 2 Replies
ADVERTISEMENT
Jan 16, 2011
I can not make this work: I can send email from bash with this script: #!/bin/bash echo "Test message" | /usr/bin/mail -s "test2" "myEmail@yahoo.com"
When I am trying to run this in Perl using system function like this:
#!/usr/bin/perl
system("'Test message' | /usr/bin/mail -s 'test2' 'myEmail@yahoo.com');
I get message that program exited with code 0 , which is nice, but mail does not get to destination.
View 6 Replies
View Related
Feb 13, 2011
SU results in Cannot execute bash: No such file or directory.
View 1 Replies
View Related
Jun 29, 2011
how to execute three processes by one script in bash.........in linux
View 1 Replies
View Related
Apr 11, 2010
In my bash file I have asked to navigate to some subdir, unzip a file and stay there but when I type pwd I can see i'm always back to home dir.Any way to get shell stick to subdir?
View 4 Replies
View Related
Dec 24, 2010
All of a sudden,i can't execute a simple script as follows:
exit 0
and:
exit
View 18 Replies
View Related
Jun 8, 2010
I just installed amanda-backup_client-2.6.0p2-1.rhel4.i386.rpm on my Red Hat Enterprise Linux 4 system. But I don't know who to check if it successfully installed or not. When I try to run amrecover from root, I get:
-bash: /usr/sbin/amrecover: cannot execute binary file
View 4 Replies
View Related
Jan 7, 2010
what is wrong i have a web server setup and working fine running a web store in php i have added a search engine for the web the easiest setup programme is with an extension .pl when i try and execute this it asks me if i want to download it or open it i had this problem with the php script which a reboot sorted out so i have tried rebooting but get the same problem does anybody know how i can get it to execute on my server?
View 2 Replies
View Related
May 9, 2011
I downloaded a program called tonespace http://www.mucoder.net/en/tonespace/ which I extracted and then tried to execute the executable file with ./tonespace. This gives me the following message:
bash: ./tonespace: No such file or directory
When I use the command: file ./tonespace I get this: tonespace: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
I dont get it. The file is clearly there, yet when trying to execute it bash doesn't seem to recognize it.
It has permissions rwxr-xr-x and is not owned by root. Am I overlooking something?
View 2 Replies
View Related
Apr 4, 2011
I'm writing a bash script that executes a few perl scripts. One of the perl scripts that I need to execute requires two arguments with it. The arguments are stored in a txt file, each line contains a hostname and its corresponding IP address separated by a ":" (colon), the txt file looks like this below:
[Code]...
I'm not sure if it's the best way to accomplish this but here it goes. In the bash file, let's call it getHosts.sh, I create an array and assign each line of the file to an element in that array. I then think I need to create a new array where I take the hostname (which is before the ":") separate it from its IP address and place the IP address on a new line just below the hostname (this way I can reference to it like $hostNames[$x] would be the hostname, and $hostNames[$x+1] would be its IP address). So the new array would now look like this below:
[Code]...
View 4 Replies
View Related
Jun 13, 2011
i want to execute system command with perlm but it gives me error.
command is wmic client. here it is
#!/usr/bin/perl
open (EP, "/home/user/Templates/domainpc.log");
while (<EP>) {
chomp;
[Code]....
View 1 Replies
View Related
Jan 1, 2010
How would I make my server execute PHP and Perl scripts? (I'm going to be working with both)
I have PHP5 and the latest Perl installed, and my installation is fresh.
Code:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
code....
View 1 Replies
View Related
Apr 27, 2011
Is it possible to simultaneously execute all perl scripts within a folder? How?
View 1 Replies
View Related
Jul 19, 2011
I have a script to utilize the perl one liner to replace a ip address.
Code:
#!/usr/bin/ksh
set -x
PRIP=172.15.100.176
OPRIP=172.15.100.115
[code]....
the script runs fine. but the perl one liner seems not working at all. but if i copy the perl line to a command line, it runs correctly.
View 2 Replies
View Related
Jul 16, 2010
I had a problem on ubuntu when running "sudo apt-get dist-upgrade" and wanted to report how I solved it. Hopefully this helps anybody with similar problems.
I always got the error message:
Code:
The problem is in libxml-sax-perl.postinst which does not seem to be executable.
I did not install any perl packages manually by cpan and found the solution in http://ubuntuforums.org/archive/inde...t-1342009.html where it was only one part of a bigger problem.
I created a backup file (always a good idea) of my libxml-sax-perl.postinst:
Code:
I deleted the old file:
Code:
Created a new file:
Code:
With the following content (copied from the link mentioned above):
Code:
View 1 Replies
View Related
Feb 25, 2011
I am trying to write a perl script which will give an interactive session to a user to execute command on the server. I have written a small script to do this :
Code: !/usr/bin/perl -w
use strict;
use Net::SSH::Perl;
my $host = '192.168.1.1';
my $username = 'user';
my $login_passwd = 'test123';
[Code]...
View 2 Replies
View Related
Jan 31, 2009
I want to execute a bash script in a C program. Bash script return some message and I want to store this message in a C program. Anybody know how can I do it.
I know I can use 'system("bash myscript.sh")' command in C. But I want to store the message which script return.
View 7 Replies
View Related
May 24, 2010
I wrote this script for bash & perl. If you run it in bash it should work. It changes title - (uuid) kernel - initrd ... to title - uuid UUID=the_uuid... kernel - initrd .... When I wrote it I replaced end of lines by . It's the second $block definition. But now I need to repair it, because I will work with the 1st $block definition. That is not to exclude end of lines, but leave it be untouched. Now when you escape the second $block definition, the code does not work. What I have to do to repair it working with multiline input data?
Code:
block="title Sata Mandriva
kernel (UUID=eab515e9-bc3e-4024-9f01-55fddaa0fb1c)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=eab515e9-bc3e-4024-9f01-55fddaa0fb1c resume=UUID=e12487ff-6d6f-44c4-9e03-33f545b3b798 splash=silent vga=788
initrd (UUID=eab515e9-bc3e-4024-9f01-55fddaa0fb1c)/boot/initrd.img"; .....
View 10 Replies
View Related
Mar 26, 2010
What i want to achieve si simple (i think).
I have this shell command:
Code:
echo -e 'ka 0 00
' > /dev/ttyS0
and i want to execute it from html or php with a button maybe or a link.(it's a command to turn off the monitor)
I am running Ubuntu 9.04 desktop with apache and php installed .
already searched the forum but didn't find/understand how to achieve this functionality.
View 14 Replies
View Related
Jun 20, 2009
I'm trying to start bash with a command and have it interactive like this:bash -i -c "echo Welcome!"As in, execute the command and allow me to use it as an interactive shell afterwards. (I'm doing something more complicated than echoing, but this doesn't work.)I've tried this from a running gnome-terminal, from one gnome-terminal to a new one withgnome-terminal and from the Alt+F2 program launcher (with "Run in terminal" ticked).
View 6 Replies
View Related
Mar 24, 2011
I am trying to process a column separated data file, with a few bash command. For example, I have
Code:
file1 aaaa yes
file2 aaaa no
file3 bbbb yes
Let say I want to create new file with the output of first column and do something else with the output of 3rd column. Of course there are many ways to process this data file, but I wish to know by using awk, how could I do it. I'm trying:
Code:
awk '{system("touch $1")}' datafile
but the shell command will not able to get the awk '$1' output. How do I get this done ? And for another question, if the data file contains the variable name of a shell variable, how could I make use of it during a awk output ? For example I have a datafile1:
Code:
server1 yes
server2 no
And in another server declaration data file, I got this datafile2:
Code:
server1=xxx1
server2=yyy1
And in my awk script, I want to achieve something like (the syntax is definitely wrong, just to demonstrate what I assume it will like):
[code]....
View 12 Replies
View Related
Nov 8, 2010
I wanted to run bash and perl scripts which requires SU privileges by clicking on desktop
Terminal window opens and closes fast without knowing what happened.
scripts work on terminal window by telling
sudo perl file.pl
sudo bash file.sh
Perl has this header
#!/usr/bin/env perl
or
#!usr/bin/perl -w
Bash has header
#!/bin/bash
How can I run them with desktop shortcuts with SU privilege so, the terminal will not close after execution? Should not the scripts work without telling perl or bash, since they have the header?
View 4 Replies
View Related
Apr 8, 2010
I've been trying to figure out a way to more easily color text in Perl like I do on Bash on a Linux box. In bash, what I'll do is set color variables up to equal the escape sequence, then echo out with escape seqeunces to print it exactly how I want it. Typically I'll want a character or a word in a different color, not the whole line. For example
echo -n -e "My face is turning ${RED}red${UNCOLOR} like a lobster." In Perl with the term::ANSIColor module, it seems to just do a line. Am I being dense? Is there a way that I can do it like I do it in BASH that's fairly easy to read after the fact?
View 11 Replies
View Related
Mar 17, 2010
I am writing a script based image manipulator but i need to know if X is running so i can tell if i use CACAVIEW to imagemagick DISPLAY command.
View 14 Replies
View Related
Feb 13, 2011
I would like to find something portable that work on all machines. I have hmtl2text installed, and perl and sh.
Anyone would know if someone already made such thing to read new through the console ?
View 1 Replies
View Related
Mar 11, 2010
I've recently inherited a bunch of files at a new job and am trying to figure out some of the problems that have constantly popped up. The one i'm getting a huge headache with results from a bash script that is supposed to change a date format from a client populated txt field to one we want defined a certain way. Everything in the script works fine, except that one function. Below is the line i'm trying to manipulate, with date examples.
sed -e 's/.0000 EA/ EA/' -e 's/ 01012010 / 01-JAN-2010 /' -e 's/ 12312011 / 31-DEC-2011 /'
The one caveat is that the first date is non-static and changes daily. It is, however, always the current date. If it helps, the second date will always be a year away from the first date.My idea was to pull the current date via perl's DATE function, but...how to do it, and calculate a year away without throwing the rest of the bash script off? Any help would be appreciated. I'm sure it's a simple solution but i know absolutely nothing about these scripts and how they were written.
View 10 Replies
View Related
Apr 1, 2010
pretty simple. how would you background a process from a script and get its process id at the same time?
View 6 Replies
View Related
Jul 11, 2010
This pretend to be a script for rename a lot of files automatically. So I put the list of files in an array named @lista. But, as you can see, at the end of the command I use a sed filter to print out a backslash for those files that have spaces in their names, so the path for those files could be rightly interpreted.
But there's no way I could print a backslash. It works well when I use the Perl's sed substitution s///, but I need every path in the array to be fixed.
I'd like to add that the bash command works perfectly well alone. I mean outside the Perl script.
This is de command line with the sed filter:
Code:
And this is what it brings:
Code:
View 12 Replies
View Related
Nov 8, 2010
I wanted to run bash and perl scripts which requires SU privileges by clicking on dektop Terminal window opens and closes fast without knowing what happened.
scripts work on terminal window by telling
sudo perl file.pl
sudo bash file.sh
Perl has this header
#!/usr/bin/env perl
[Code]....
How can I run them with desktop shortcuts with SU privilege so, the terminal will not close after execution?
should not the scripts work without telling perl or bash,
View 1 Replies
View Related
Jul 29, 2011
I've been asked to do certain jobs doing scripts in bash and perl. So this time they asked me to check which users hasn't been able to loggin. DONE with Code: lasb Now they asked me to show how many times all the users have input certain Bash Commands like
Code: Ls Cd pwd I was wondering if there was a command of something that could show me how many times those commands has been used, I already know I can see all input with Code: history Sorry I'm really new to this, been working with this for a couple of weeks, and its really interesting.
View 3 Replies
View Related