I've agonised over the same problem in the past (usually bash rather than perl, but the principle remains the same), and I finally succumed to hard coded formatting in the script.
I know that I can run a python script from my bash script using the following:
python python_script.py
But what about if I wanted to pass a variable / argument to my python script from my bash script. How can I do that?
Basically bash will work out a filename and then python will upload it, but I need to send the filename from bash to python when I call it.
I'm trying to find a decent ide to use with bash scripting, it seems a lot of the top ides kind of overlook bash, I'm using geany but I would like one that has support for collapsing and expanding various sections of script like it does with python, for example collapse an IF statement so its out of the way to make long code more manageable, I would also like to find one if possible that can run y
My target is to create the /var/tmp/add_user.bash script by /var/tmp/create_script_add_user.bash script
and run the expect script ( add_user.bash ) from create_script_add_user.bash script.
The problem is that when I run the script add_user.bash from create_script_add_user.bash, then expect stuck on the question:
Proceed?
The following perl statement in a bash script consists of two substatements. I intend the first perl substatement (the assignment with glob) to get input from the preceding bash pipe, and the second perl substatement (the foreach loop) to output back to bash.
Hi,
I have been thinking of how to script this but i have no clue at all..
Could someone please help me out or give me some idea on this?
I would like to group those lines with the same first variable in each line, joining the 2nd variables with commas.
Let's say i have the following input.
Code:
aa c1
aa c2
aa c3
cc d1
dd e1
dd e2
ee f1
I would like the output to be like this.
Code:
aa
I'm using the linux 'script' command http://www.linuxcommand.org/man_pages/script1.html to log all input and output in an interactive bash script.
At the moment I have to call the script command, then run my bash script, then exit.
I want to run the script and exit commands from within the actual bash script itself.
How may I know if a script is either written in bash or sh?
The first line of the script mean nothing, since on Linux, bash script has this line:
#!bin/sh
Actually, there are many distribution where bin/sh is bash (maybe a bin/sh is a link to bin/bash in those distro), and not bourn shell.
I have a bash script which is calling another python script.
This is not running in cron because of python global variable. Please find below the script. Script is meant to zip logs and move to Amazon s3. When we run the script from terminal it will work. But when ran from cron it will zip contents then s3cmd which is a python script it fails.