Sponsored Content
Full Discussion: Case Statement Troubles
Top Forums Shell Programming and Scripting Case Statement Troubles Post 302594952 by tekster2 on Wednesday 1st of February 2012 03:56:02 PM
Old 02-01-2012
I added that, it still errors out on line 49, which is where the [RHEL]*) is. It looks like this now:
Code:
HOSTNAME=$(uname -n)

cd /tmp

echo "Line to catch HHLD Connectivity status"

case ${HOSTNAME} in

[AIX]*) 
	lsldap -a passwd rzttwp > /dev/null 2>&1
ret=$?
 
if [ $ret -ne 0 ]; then
	echo "!!!:${HOSTNAME}:no"
	    else
	echo "!!!:${HOSTNAME}:yes"
	

[RHEL]*)
	getent passwd rzttwp > /dev/null 2>&1    
ret=$?
 
if [ $ret -ne 0 ]; then
	echo "!!!:${HOSTNAME}:no"
	    else
	echo "!!!:${HOSTNAME}:yes"

esac

---------- Post updated at 02:45 PM ---------- Previous update was at 02:41 PM ----------

Update: I removed the * signs from in front of ) signs and still get error: syntax error at line 49: `)' unexpected


so it's still buggy lol

---------- Post updated at 02:47 PM ---------- Previous update was at 02:45 PM ----------

@methyl: Yes, I have and am definitely in need of training. I am doing this for work because they need someone to do it, I'm the lucky guy. It's not somehting I usually do and I don't have time to take training right away...I do need it tho I agree.

---------- Post updated at 02:55 PM ---------- Previous update was at 02:47 PM ----------

I am making edits using notepad++ and just using WinSCP to push the edited script back up, so not vi on server. The machine OS is RHEL 5.3. The error is syntax...here's a good example: syntax error at line 46: `;;' unexpected

With this code:

Code:
HOSTNAME=$(uname -n)

cd /tmp

echo "Line to catch HHLD Connectivity status"

case ${HOSTNAME} in
	[AIX]) 
		lsldap -a passwd rzttwp > /dev/null 2>&1
	ret=$?
 
	if [ $ret -ne 0 ]; then
		echo "!!!:${HOSTNAME}:no"
			else
		echo "!!!:${HOSTNAME}:yes"
	;;
	[RHEL])
		getent passwd rzttwp > /dev/null 2>&1    
	ret=$?
 
	if [ $ret -ne 0 ]; then
		echo "!!!:${HOSTNAME}:no"
			else
		echo "!!!:${HOSTNAME}:yes"
	;;
esac

---------- Post updated at 02:56 PM ---------- Previous update was at 02:55 PM ----------

Line 46 is above the RHEL part

Last edited by methyl; 02-01-2012 at 05:12 PM.. Reason: Please learn about code tags....; and more code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case statement

Hi all, is it possible to create a 'dynamic' case statement. ie select option in `ls` do case satement depending on results of the above `ls` done I hope I have explained this ok! Thanks Helen (1 Reply)
Discussion started by: Bab00shka
1 Replies

2. Shell Programming and Scripting

Case Statement

Can anyone please tell me why this wont work! Thanks so much! #!/bin/sh for file do case $file in *.*.*) echo Cannot have more than 1 dot exit ;; *'**'*) echo Cannot have more than 1 asterisk exit ;; *'*'*|?.) echo this is a target (19 Replies)
Discussion started by: Zeta_Acosta
19 Replies

3. Shell Programming and Scripting

case statement

hi all i'm writing a script and in it i need to prompt the user if the entered value is correct or not ,i wrote the following and its not working ,its executing the script even if i enter Y/N pls any help is appreciated echo "\nAre you sure you entered the right Destination Environment? y :... (5 Replies)
Discussion started by: bkan77
5 Replies

4. UNIX for Dummies Questions & Answers

If or Case Statement

I want to write a program with the following variables: a=7000 b=24000 c=613.8 The user can enter two words: Vivid or Blue for example. The challenge is that the user might not want to write the words the way they appear. The user can write V or v or vivid or Vivid or write Blue or blue, or B,... (1 Reply)
Discussion started by: Ernst
1 Replies

5. UNIX for Dummies Questions & Answers

CASE statement

Hi, I am writing a bash shell script. My script has a few user defined parameters. When the script runs the first thing it does is make sure that these parameters are valid. One of the parameters is called YEAR. A valid input for YEAR can be 1997-2000. One way I have come up with to ensure... (3 Replies)
Discussion started by: msb65
3 Replies

6. Shell Programming and Scripting

help with case statement

I am writing a script to pull diskspace information from our servers. Here is the script that I wrote: #!/bin/ksh for host in `cat /oper/hosts/esc.misc` do ssh -q -o ConnectTimeout=10 operator@$host df -h|grep "/dev/" |egrep '8%|9%|100%' | awk '{print H " " "at " $5 " with " $4 "... (1 Reply)
Discussion started by: rkruck
1 Replies

7. Shell Programming and Scripting

if-statement troubles

I try to compare the day and month of someones birthday with the day and month of today, so my little bash script can send a mail to the person that has its birthday that day. The first line of the file birthdays looks like this: firstname,lastname,01/01/1990,.... The variable birthday's... (4 Replies)
Discussion started by: doc.arne
4 Replies

8. Shell Programming and Scripting

case statement

Hi, I am writing case statement to execute some finction, my requirement is once one of the case statement is executed again it has to prompt for the option. for script in `echo "$Script_Selected"` do case $script in 1) getNoOFActUsers ;; 2) moveServerrOORotation ;; ... (2 Replies)
Discussion started by: Satyak
2 Replies

9. Shell Programming and Scripting

Case Statement

Hey, guys I really need some help with a project. "Write a shell program that examines the command line arguments, counts and collects the number of options. Basically it has to collect and count the arguments that start with a "-" and the one's that don't start with a - I know I have to use... (2 Replies)
Discussion started by: sk192010`
2 Replies

10. Homework & Coursework Questions

Case Statement

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hey, guys I really need some help with a project. "Write a shell program that examines the command line... (8 Replies)
Discussion started by: sk192010`
8 Replies
lta(4)							     Kernel Interfaces Manual							    lta(4)

Name
       lta - lta pseudoterminal interface

Syntax
       options LAT
       pseudo-device lat
       pseudo-device lta[n]

Description
       The  pseudoterminal  interface  provides  support  for local area transport (LAT) service.  LAT service allows users to access remote nodes
       through the Ethernet.

       To configure the LAT service for your machine, you must:

       o   Edit the system configuration file.

       o   Edit the file.

       o   Create LAT special files.

       o   Edit the file.

       Instructions for performing these tasks are further documented in the Guide to Ethernet Communications Servers.

   Edit the Configuration File
       Edit the configuration file  to	include  the  option  and  the	and  pseudo-devices.   The  configuration  file  to  edit  is  located	in
       /sys/conf/vax/HOSTNAME  or  /sys/conf/mips/HOSTNAME  (depending	on  your processor), where HOSTNAME is the name of your host processor, in
       uppercase.

       The optional value for the pseudo-device entry defines the number of LAT lines to configure, a number between 1 and 256.   If  you  do  not
       specify	a  value,  the	default is 16 lines.  For example, if you want to configure 32 LAT devices into your system, the entry for the LAT
       lines is:
       pseudo-device lta32

       To use the system as a load host for remote note maintenance functions such as loading and controlling  terminal  servers,  you	must  also
       include an options entry for and a pseudo-device entry for in the configuration file.

   Edit the /etc/rc.local File
       Edit  the  file	to restart LAT service automatically when the system reboots.  Add the following entry after the commands for local daemon
       startup:
       if [ -f /etc/lcp ]; then
	    /etc/lcp -s > /dev/console & echo -n ' lat' >/dev/console
       fi

   Create LAT Special Files
       Create the LAT special files by running the program from the directory and specifying the option.  You create one LAT special file for each
       LAT device.  For example, the following commands create 32 device special files for LAT devices:
       # cd /dev
       # MAKEDEV lta0
       # MAKEDEV lta1

       The option range is 1 to 7.  The maximum number of LAT special files is 256.

   Edit the /etc/ttys File
       Edit  the  file	to  include entries for all the LAT special files you created using the command.  For more information on how to add these
       entries, see

Files
       Contains terminal devices defined to the machine.

       Contains terminal devices defined to the machine (modem lines only).

See Also
       ttys(5), MAKEDEV(8)
       Guide to Ethernet Communications Servers

																	    lta(4)
All times are GMT -4. The time now is 02:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy