john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Functions variables as parameters

!/bin/bash

weird requirement to return a string

function finder { echo "A" }

temp=$(finder) echo "$temp"

!/bin/bash

function updatefile( ) { if [ $# -ne 2 ]; then echo "incorrect function parameters" exit 0 else echo "sed 's/$1/g' $2 -i" sed "s/$1/g" $2 -i fi }

VARIABLE CONFIGURATION

TARGETFILE="*/WEB-INF/app.properties"

DATABASEHOST="localhost:3306/10.10.10.193"

START PROCESSING

updatefile "$DATABASEHOST" "$TARGETFILE"

LOG CONFIG AND PROCESSING

TARGETFILE="*/WEB-INF/log4j.xml" DEBUGTOINFO="debug/INFO" updatefile "$DEBUGTOINFO" "$TARGETFILE"


  • « swing slideshow ImageViewer
  • HttpsUtility »

Published

Jun 9, 2012

Category

linux

~56 words

Tags

  • as 12
  • functions 7
  • parameters 15
  • scripts 63
  • variables 5