I am very new to all these programming languages and really love Linux but have only begun to dive into bash scripting... I am curious what's going on with this script...
Thanks in advance!
Also I hope yo ucan forgive me as I just realised there is a thread for bash scripting haha PLEASE FORGIVE ME!!!!!!!!!!
Last edited by BrianBlaze; 08-10-2012 at 12:29 PM..
So, if /proc/xen/capabilities exists, it checks if the string control_d exists inside it.
If it doesn't, it quits immediately, not bothering to run the xen command on the bottom.
If it does, it doesn't quit, and continues through to the statement on the bottom.
So in effect, it only runs the statement on the bottom if control_d is found in /proc/xen/capabilities, or /proc/xen/capabilities doesn't exist.
It's done in a slightly awkward way. $? isn't needed. I'd just do this:
&& is kind of a short-form if, || is a short form if-not. So, if /proc/xen/capabilities exists, AND control_d is not found inside it, exit immediately.
Hi all,
I have a moderate size (300 lines) BASH Shell script that performs various tasks on different source reports (CSV files). One of the tasks that it performs, is to use SED to replace 'non-conforming' titles with conformant ones. For example "How to format a RAW Report" needs to become... (3 Replies)
Hello,
I heva a problem creating a script that read specifc value from all the files of an entire folder
I have a number of email files into a directory and i need to extrect from each file 2 specific values.
After that i have to put them into a new file that looks like that:
To: value1
... (1 Reply)
Ok, so I have a bash script with an embedded expect statement.
Inside of the expect statement, i'm trying to pull all of the non-comment lines from the /etc/oratab file one at a time.
Here's my command:
cat /etc/oratab |sed /^s*#/d\ | awk 'NR==1'|awk -F: '{print \"$1\"}'|. oraenv
Now,... (0 Replies)
I'm putting together a script that will search my mail archives for emails that meet certain criteria and output the files to a text file.
I can manually cat that text file and pipe it into sendmail and it will work (i.e. cat /pathtofile/foo.txt | sendmail -t me@company.com)
My script sends... (7 Replies)
I'm writing a bash script that reads a file location from a user, and I'm wondering how to get the script to accept tab to auto complete the directories that are input. (8 Replies)
Hello everyone,
I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily.
Now, the... (2 Replies)
Hi Guys,
I am new to unix scripting and I am tasked to parse through a CSV file delimited by #.
Sample:
sample.csv
H#A#B#C
D#A#B#C
T#A#B#C
H = Header
D = Detail Record
T = Tail
What I need is to read the file and parse through it to get the columns.
I have no idea on how... (8 Replies)
Hi all,
I'm sure this is quite a simple problem, but i'm completely new to shell scripting, so bare with me. Having problems with the read command. Here's what I have:
read -rp "Command to execute: " the_command
...
...
echo "$the_command"
...
...
eval "$the_command"
Now, say, for... (8 Replies)
Hi All,
I'm trying to concoct a bash script to use with a Puppet Implementation that will accept a hostname and break it down into variables.
For example, my hostnames look like this --> machinename-group-building.example.com
I'm looking for a way in the script to read until the first... (4 Replies)
Hi,
root@server] df -h
121G 14G 101G 12% /home
147G 126G 14G 91% /backup
We having our site files and images are storing in
/backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following.
root@server] cd /home... (1 Reply)