04-11-2006
thanks, i just have another question. I have two files - 'menu' and 'addword'. The user has to run 'sh menu' and then a menu appears asking the user to enter a filename and to press 0 from the menu to add a word to the end of the text in the entered filename.
Now, i entered a filename at the beginning of the menu when it asked me to and this was stored in $file as you can see from the code, but when i choose to run addword by pressing menu option 0, i entered a word to add, but it would not add to $file. It says ambiguous redirect. It is as though the filename that i entered at the menu option has been forgotten. Can it not stay in memory for more than one file? thanks.
----------------------------
Menu
----------------------------
echo "enter filename of text"
read file
echo "0: Add word"
read entry
case $entry in
0) sh addword;;
esac
echo
done
--------------------------------
addword
--------------------------------
echo "Enter the new line to add:"
read newline
echo "$newline" >> $file
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job.
linux1
linux2
linux3
linux4
linux5 ......
.
.
.
.
.
1.) How can i enter "password" in script rather asking me?
I was trying this...
ssh... (2 Replies)
Discussion started by: deal732
2 Replies
2. UNIX for Dummies Questions & Answers
Dear all,
I want to change all the File name in a folder from File1.txt to
File1YYYYMMDD.txt where YYYYMMDD is the date of the file is renamed.
I have used the following scripts:-
********************************************************
#!/bin/ksh
A=`date +"%d%m%Y"
for in * ... (2 Replies)
Discussion started by: balzzz
2 Replies
3. UNIX for Dummies Questions & Answers
Hi guys,
I desperately need your help on my problem:-
I got a folder in my directory that has many files in it. Most of the file's name is starting with certain prefix. Eg: ABC, CDE, EFG, etc. I only want to change file name that is starting from certain prefix and the rest I want them to... (1 Reply)
Discussion started by: balzzz
1 Replies
4. Shell Programming and Scripting
Hi, I want to change on a file this line:
vif =
into:
vif =
But there are some conditionals:
1. last part '] of the original line after 00:16:3E:CE:23:14' ] may vary to 00:16:3E:CE:23:14' ] or 00:16:3E:CE:23:14 ' ]
2. The second mac adrress of the line I need,... (4 Replies)
Discussion started by: iga3725
4 Replies
5. Shell Programming and Scripting
i have a file a.txt contents as 1,2,3,4,......etc...in a single line, i want to write to another file in rows as
1
2
3
4
5
can u help?
i do not know the length of a.txt (4 Replies)
Discussion started by: pravfraz
4 Replies
6. Shell Programming and Scripting
Write a shell program to replace the starting alphabet "a" with "k" for the file names in the current directory.
Note : Change only the file names starting with "a". Rest of the file names remains unchanged.
Homework. Replies deleted. Closed. (0 Replies)
Discussion started by: shashwat2691
0 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I have several text files each containing some data as shown below:
File1.txt
>DataHeader
Data...
Data...
File2.txt
>DataHeader
Data...
Data...
etc.
What I want is to change the 'DataHeader' based on the file name. So the output should look like:
File1.txt
>File1
... (1 Reply)
Discussion started by: Fahmida
1 Replies
8. Shell Programming and Scripting
i have a requirement where i needed to change variable values in a properties file(first file) whenever there is change to Release details file(second file). My question is do i have to create a daemon process that always checks the modified time/inode change of the second file and then change the... (1 Reply)
Discussion started by: saikiran_1984
1 Replies
9. Homework & Coursework Questions
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:
Make “hardlink” readable, writeable, executable by you, but not readable, writeable, executable by anyone else.... (4 Replies)
Discussion started by: lilbo4231
4 Replies
10. Shell Programming and Scripting
Hi,
I have used expdp for datapump. The .dmp file is created by the "oracle" user.
my requirement is to make a zipped file of this .dmp file.
What i am trying to do is change the permissions of this .dmp file from 0640 to 0644 and then do a gzip and zip it. Is there any way i can change... (3 Replies)
Discussion started by: qwertyu
3 Replies
LEARN ABOUT NETBSD
menu_post
MENU_POST(3) BSD Library Functions Manual MENU_POST(3)
NAME
post_menu, unpost_menu -- post (draw) or unpost a menu
LIBRARY
Curses Menu Library (libmenu, -lmenu)
SYNOPSIS
#include <menu.h>
int
post_menu(MENU *menu);
int
unpost_menu(MENU *menu);
DESCRIPTION
The post_menu() function causes the menu to be drawn on the screen. Any functions defined by either set_menu_init() or set_item_init() (see
menu_hook(3)) are called before the menu is placed on the screen. The unpost_menu() does the opposite, it removes a menu from the screen.
Any functions defined by both set_menu_term() and set_item_term() (see menu_hook(3)) are called prior to the menu's removal.
RETURN VALUES
The functions return one of the following error values:
E_OK The function was successful.
E_SYSTEM_ERROR There was a system error during the call.
E_BAD_ARGUMENT One or more of the arguments passed to the function was incorrect.
E_POSTED The menu is already posted.
E_BAD_STATE The function was called from within an initialization or termination routine.
E_NO_ROOM The menu does not fit within the subwindow.
E_NOT_CONNECTED The item is not connected to a menu.
SEE ALSO
curses(3), menu_hook(3), menus(3)
NOTES
The header <menu.h> automatically includes both <curses.h> and <eti.h>.
BSD
September 10, 1999 BSD