Sponsored Content
Full Discussion: Can anyone help
Top Forums UNIX for Dummies Questions & Answers Can anyone help Post 27099 by madtim on Tuesday 27th of August 2002 06:54:53 PM
Old 08-27-2002
Can anyone help

This is how far I have got, but it still doesnt do what it is supposed to

The code is to be written on KornShell and has to be done command line and
menu form, im trying to do the menu code first
then the command line will be simpler.

The question is:

for each file in the directory <dir_name>, display its name, together with
the word file if it is a normal file,
dir if it is a directory or other if it is neither a normal file nor a
directory, and the word readable if the file is readable by
the current user. For example, a typical output might be:

fool.c file readable
foo2.c file
foo3 other readable
progs dir readable

finfo
Code:
while getopts :t args

do
	case $args in
	
	t) print "t option: data: $OPTARG";;
	
	
	esac
	
done

((pos = OPTIND -1))
shift $pos

PS3='option> '

if (( $# == 0 ))
then if (( $OPTIND == 1 ))
then select menu_list in dirinfo exit

do case $menu_list in

###################################################################################################

	dirinfo) 
	
	print "***************************************************************************";
	print "* This option shows the different files in a directory and its attributes *";
	print "***************************************************************************";
	print "";
	print "Enter the directory name";
	print "";
	
	read dir_name;	
	
	if test -d $dir_name
	
	then 
		
	cd $dir_name

	ls -1 
	
	else
		
		print ""
		print "The name you have entered is not a directory."
		print ""
	
	fi;
	
	print ""
	print "Hit enter to continue"
	read junk;;
	
###################################################################################################
	
	exit) exit;;
	
	*) print "unknown option";;
	
	esac
	
	done
	
	fi
	
	else print "extra args??: $@"

fi

inserted code tags for readability --oombera

Last edited by oombera; 02-16-2004 at 01:01 PM..
 
tk_popup(1T)						       Tk Built-In Commands						      tk_popup(1T)

__________________________________________________________________________________________________________________________________________________

NAME
tk_popup - Post a popup menu SYNOPSIS
tk_popup menu x y ?entry? _________________________________________________________________ DESCRIPTION
This procedure posts a menu at a given position on the screen and configures Tk so that the menu and its cascaded children can be traversed with the mouse or the keyboard. Menu is the name of a menu widget and x and y are the root coordinates at which to display the menu. If entry is omitted or an empty string, the menu's upper left corner is positioned at the given point. Otherwise entry gives the index of an entry in menu and the menu will be positioned so that the entry is positioned over the given point. EXAMPLE
How to attach a simple popup menu to a widget. # Create a menu set m [menu .popupMenu] $m add command -label "Example 1" -command bell $m add command -label "Example 2" -command bell # Create something to attach it to pack [label .l -text "Click me!"] # Arrange for the menu to pop up when the label is clicked bind .l <1> {tk_popup .popupMenu %X %Y} SEE ALSO
bind(1T), menu(1T), tk_optionMenu(1T) KEYWORDS
menu, popup ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTk | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tk is available on http://opensolaris.org. Tk 4.0 tk_popup(1T)
All times are GMT -4. The time now is 01:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy