Sponsored Content
Top Forums Shell Programming and Scripting Compact script with array - Good idea? Post 302676301 by Corona688 on Tuesday 24th of July 2012 11:29:32 AM
Old 07-24-2012
Code:
#!/bin/bash
# Requires bash, don't use other shells

MAKE_OPTS="-j 4"
CONFIG_OPTS="--prefix=/opt"

url_nginx="http://nginx.org/download/nginx-1.2.2.tar.gz"
nginx_MAKE="-j 3" # Override default MAKE_OPTS

url_supervisor="http://pypi.python.org/packages/source/s/supervisor/supervisor-3.0a12.tar.gz"
supervisor_CONFIG="--prefix=/usr" # Override default CONFIG_OPTS

for PACKAGE in nginx supervisor
do
        # Check for package_MAKE variable, use default $MAKE_OPTS if absent
        MOPTS="${PACKAGE}_MAKE"
        MOPTS="${!MOPTS:-${MAKE_OPTS}}"
        # Check for package_CONFIG variable, use default $CONFIG_OPTS if absent
        COPTS="${PACKAGE}_CONFIG"
        COPTS="${!COPTS:-${CONFIG_OPTS}}"

        PACKAGE="url_${PACKAGE}"
        echo wget "${!PACKAGE}"
        echo configure $COPTS ... # Note not quoted
        echo make $MOPTS ... # Note not quoted
done

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Dual Boot a good idea?

I was just wondering if it would be alright to dual boot a machine with both UNIX using XTERM for the interface and windows 98 or if people consider this a bad idea? if you consider it bad do tell me some possible alternatives..also would it be better to get linux over pure unix? I'd like a visual... (8 Replies)
Discussion started by: PravusMentis
8 Replies

2. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

3. Shell Programming and Scripting

any good idea on this?

txt file like this, 1 2 3 4456 a bb c d 3 f e 1 k 32 d m f e 123 m 2 k every line contains 3 or more columns, all the columns are separated by space, and every column includes 1 to 3 character. what I wanna do is deleting the first three columns, and keep the rest no matter how long... (7 Replies)
Discussion started by: fedora
7 Replies

4. Shell Programming and Scripting

Script Idea's / Help

Hi there, I'm pretty new to scripting and wondering if anyone had any idea's, scripts or snippets on how I can do the following. I basically want a shell script that will look at all the files in a directory and find all the names and addresses in them then output them to the screen nicely... (12 Replies)
Discussion started by: mrpugster
12 Replies

5. Shell Programming and Scripting

Script to compact information !

Hello Group, Could you please help me with a shell script that condense in this case each 12 rows of hour information in only one row per day as following: Final Fields in each row 1.Ticker Name 2. D (Daily) 3. Date 4. Open Price (The open price of the first record of the day) 5. High... (13 Replies)
Discussion started by: csierra
13 Replies

6. Shell Programming and Scripting

Help with the idea of a script to modify time

Hello friends, I need an idea or a ready solution for a problem i have the following lines in text file: 1 20100920140122 object4 MOVE IN 2 20100920150012 object4 MOVE OUT -- cut -- the second column is the date and time: 20100920140122 = 2010 09 20 14:01.22 what I need to do is to add 40... (8 Replies)
Discussion started by: peetteerr
8 Replies

7. UNIX for Advanced & Expert Users

echo 1 > /proc/sys/vm/drop_caches a good idea?

Hi folks. I work with several production servers, and I have seen in some Kernel Cache using most of the memory. See this pic: http://i51.tinypic.com/301nb6c.jpg Do you think this is a smart choice? Remember these are productions servers and it is extremely necesary this does not... (6 Replies)
Discussion started by: erick_tuk
6 Replies

8. Shell Programming and Scripting

need a new idea for a script

Hi all, I now have project in UNIX Solaris and I want to have some new ideas to execute it, so I hope you help me finding new ideas in scripting or some infrastructure .bye (1 Reply)
Discussion started by: hard_revenge
1 Replies
Module::Loaded(3pm)					 Perl Programmers Reference Guide				       Module::Loaded(3pm)

NAME
Module::Loaded - mark modules as loaded or unloaded SYNOPSIS
use Module::Loaded; $bool = mark_as_loaded('Foo'); # Foo.pm is now marked as loaded $loc = is_loaded('Foo'); # location of Foo.pm set to the # loaders location eval "require 'Foo'"; # is now a no-op $bool = mark_as_unloaded('Foo'); # Foo.pm no longer marked as loaded eval "require 'Foo'"; # Will try to find Foo.pm in @INC DESCRIPTION
When testing applications, often you find yourself needing to provide functionality in your test environment that would usually be provided by external modules. Rather than munging the %INC by hand to mark these external modules as loaded, so they are not attempted to be loaded by perl, this module offers you a very simple way to mark modules as loaded and/or unloaded. FUNCTIONS
$bool = mark_as_loaded( PACKAGE ); Marks the package as loaded to perl. "PACKAGE" can be a bareword or string. If the module is already loaded, "mark_as_loaded" will carp about this and tell you from where the "PACKAGE" has been loaded already. $bool = mark_as_unloaded( PACKAGE ); Marks the package as unloaded to perl, which is the exact opposite of "mark_as_loaded". "PACKAGE" can be a bareword or string. If the module is already unloaded, "mark_as_unloaded" will carp about this and tell you the "PACKAGE" has been unloaded already. $loc = is_loaded( PACKAGE ); "is_loaded" tells you if "PACKAGE" has been marked as loaded yet. "PACKAGE" can be a bareword or string. It returns falls if "PACKAGE" has not been loaded yet and the location from where it is said to be loaded on success. BUG REPORTS
Please report bugs or other issues to <bug-module-loaded@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-11-04 Module::Loaded(3pm)
All times are GMT -4. The time now is 02:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy