LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2018, 02:24 PM   #1
Gerald_john
LQ Newbie
 
Registered: Feb 2018
Posts: 8
Blog Entries: 1

Rep: Reputation: Disabled
Environment (ISZ, Prod, Dev) by using case statement


have few system in different environment (ISZ, Prod, Dev) by using case statement and need to run another script and update the systems in different environment name, please find the script below:

#!/bin/bash

#This script is used case command for yum update for diffrent env.
#Need to select Environment

echo "environment [isz_dev]:"
cat $(//home/fk006160/gerscript/systemlist/env/isz_dev.txt)
read environment

case $environment in
sudo /home/fk006160/gerscript/script/hdusage.sh
;;
esac
 
Old 04-23-2018, 02:34 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Is there a question here?
 
Old 04-23-2018, 02:47 PM   #3
Gerald_john
LQ Newbie
 
Registered: Feb 2018
Posts: 8

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
i want a script which are read the environment(ISZ, DEV, prod) and run my second script, by using case statement, i am new scripting.
 
Old 04-23-2018, 05:46 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Well, you would make a case statement for each environment. If there's one possible choice, you don't really need a case statement. If I'm reading this correctly, your script is so far off that I can't determine what it's supposed to do. And it doesn't help that the explanation is poor.
 
Old 04-24-2018, 06:39 AM   #5
Gerald_john
LQ Newbie
 
Registered: Feb 2018
Posts: 8

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
i am new scripting please find the below script

#!/bin/bash
#running the script on different environment
echo "will run on different environment"
for line in $(< /home/fk006160/gerscript/systemlist/env/isz_dev.txt)
do
ssh $line "hostname"

case $line in
isz_dev.txt )
echo "ISZ-Pre-Prod"
/home/fk006160/gerscript/script/hdusage.sh
;;
esac
done

unable to get output on case command or unable to run the case command
 
  


Reply

Tags
bash script $@, shell script, unix



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spacewalk cloning test/dev to prod constantm Red Hat 2 03-21-2016 01:56 PM
certification in AIX or Linux in Prod or Non-prod environment ! sid2803 Linux - Newbie 2 06-11-2012 08:05 PM
Perl switch statement throwing error like Bad case statement (invalid case value?) kavil Programming 2 10-07-2010 04:50 AM
in prod environment sap support vmware abhijeetdutta Linux - Virtualization and Cloud 1 09-23-2010 01:34 PM
Case statement with If statement cbo0485 Linux - Newbie 4 11-07-2007 08:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration