I am have an issues with one of my scripts. I get the following error when I get to the point in the script where I am making the change. The change does take however. the error is "change: xecho: execute permission denied"
Everything was working properly until I start cleaning up the code. (indent)
Code:
ans=y
while [ "$ans" = "y" ]
do
cat<<here0
${bold}Please enter the name of the user you want to change:${off}
here0
read name
clear
grep -in "$name" phonebook | sed -n -e 's/^/\
/' -e 's/:/\
/gp'
cat<<here1
${blink}${bold}Please enter the record that you want to change:${off}
here1
read number
record=`sed -n ${number}p phonebook`
name=`echo "$record"| cut -d: -f1`
address=`echo "$record"|cut -d: -f2`
city=`echo "$record"|cut -d: -f3`
state=`echo "$record"|cut -d: -f4`
zip=`echo "$record"|cut -d: -f5`
phone=`echo "$record"|cut -d: -f6`
echo "Do you want to change $name's name? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new name"
read newname
name=$newname
fi
xecho "Do you want to change $address? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new address"
read newaddress
address=$newaddress
fi
echo "Do you want to change $city? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new city"
read newcity
city=$newcity
fi
echo "Do you want to change $state? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new state"
read newstate
state=$newstate
fi
echo "Do you want to change $zip? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new zip"
read newzip
zip=$newzip
fi
echo "Do you want to change $phone? (y/n) \c"
read ans
if [ "$ans" = "y" ]
then
echo "Please enter new phone number"
read newphone
phone=$newphone
fi
sed "$number"d phonebook > phonebook.tmp
mv phonebook.tmp phonebook
echo "$name:$state:$city:$state:$zip:$phone" >> phonebook
echo "Would you like to change another record? /c"
read ans
done
---------- Post updated at 04:04 PM ---------- Previous update was at 03:14 PM ----------
Never mind I found the issue. It was a typo.
One other issue that I am having is when a user is not found in the file it hangs until the user presses return. How can I do some type of validation?
I am very new to Unix. We have a script that will remove files from a directory. The account removing the files has the same permissions as the directory the files are located. We have logged in as the account and deleted the files from that directory but when we run the script with the account... (7 Replies)
When I do a 'cd /appl' and issue 'ls -al' command, I get the following error for .. directory.
./..: Permission denied
But still I get a listing of other directories under /appl.
Also, if I give 'man' for any command under this /appl folder, I get the following error:
... (3 Replies)
When I try to run xterm at a command prompt in solaris 2.5.1, i'm getting a permission denied error. But the directory and user permissions look ok, they are part of a users group and then also root,sys,adm so what gives? Any ideas? Thanks! (1 Reply)
hi,
i have a problem and is needed by next week.
when i need to run a program at the specified time using the crontab, after that the program which will send a messege to the screen using the say command, which will show "Hello"
but there is an error when i run it, in the mail it show that
... (5 Replies)
Hi
i am running the below script in vio server,
i changed to aix mode..then
#./script1
</code>
##Set today Date as file name.
vardate= date +"%m%d%y%H%M%S"
varhost= hostname
filename= "$varhost_$vardate"
echo $filename
</code>
the output is .......
</code>
# ./mount_test ... (6 Replies)
Hello All,
We have an existing ssh set-up between 2 Unix servers ( Server A and Server B). Recently, we've had a problem where we cannot delete files (via app engine and even manually, after connecting thru ssh) on Server B. We manage Server A but Server B is handled by a different group, as a... (1 Reply)
Hello,
I am using Tiger 10.4.11
I am trying out the GIMP, so I installed the X11 package from "Optional Installs" on the cd.
Whenever I open X11, I get an error:
xterm: could not exec /dev/null: Permission denied
I have chmodded /dev/null to 777, as well as the /tmp directory.
I deleted... (2 Replies)
Hi All,
Need your help..
I am writing one script in which I am assigning value to one variable but when i am executing it is showing error "0403-006 Execute permission denied"
below is the line of that script :
INPUT_COUNT=wc $GIF_DIR/input/VID_RIMS.DAT | awk '{print $1}'
and access... (2 Replies)
Hello,
I was trying a perl-cgi tutorial and saving the data from online form to a file named (guests.txt). I am using the localhost port 80 for practice.
My page file "guestbook.html" is working as I saw the online form. After filled out the blanks and submit, I was expecting to see the result... (3 Replies)
Hello,
I have managed to install rsync using swinstall and also as far as I can tell the dependancies we didn't have. However when trying to execute the binary I get the following error :-
/>rsync
sh: rsync: Execute permission denied.
/>which rsync
/usr/local/bin/rsync... (10 Replies)
Discussion started by: YogaBija
10 Replies
LEARN ABOUT OPENDARWIN
chdir
CHDIR(2) BSD System Calls Manual CHDIR(2)NAME
chdir, fchdir -- change current working directory
SYNOPSIS
#include <unistd.h>
int
chdir(const char *path);
int
fchdir(int fd);
DESCRIPTION
The path argument points to the pathname of a directory. The chdir() function causes the named directory to become the current working
directory, that is, the starting point for path searches of pathnames not beginning with a slash, '/'.
The fchdir() function causes the directory referenced by fd to become the current working directory, the starting point for path searches of
pathnames not beginning with a slash, '/'.
In order for a directory to become the current directory, a process must have execute (search) access to the directory.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Chdir() will fail and the current working directory will be unchanged if one or more of the following are true:
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters.
[ENOENT] The named directory does not exist.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
[EACCES] Search permission is denied for any component of the path name.
[EFAULT] Path points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the file system.
Fchdir() will fail and the current working directory will be unchanged if one or more of the following are true:
[EACCES] Search permission is denied for the directory referenced by the file descriptor.
[ENOTDIR] The file descriptor does not reference a directory.
[EBADF] The argument fd is not a valid file descriptor.
SEE ALSO chroot(2)STANDARDS
The chdir() is expected to conform to IEEE Std 1003.1-1988 (``POSIX.1'').
HISTORY
The fchdir() function call appeared in 4.2BSD.
4th Berkeley Distribution December 11, 1993 4th Berkeley Distribution