Problem with execute my file permission


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with execute my file permission
# 1  
Old 05-16-2010
Problem with execute my file permission

Here is my script.
Code:
      1 echo -n "Enter file name : "
      2 read file
      3 chmod 777 $file
      4 [ -w $file ] && W="write = yes" || W="Write = no"
      5 chmod 777 $file
      6 [ -x $file ] && X="Execute = yes" || X="Execute = No"
      7 chmod 777 $file
      8 [ -r $file ] && R="Read = yes" || R="Read = No"
      9 echo
     10 echo "$file permissions"
     11 echo "$W"
     12 echo "$R"
     13 echo "$X"

I want my script can do the following problem is display a listing of the user's directory and allow permission change. Prompt the user to change file permission (y/n). If yes, prompt the user for the file name. Display the file's permission. Ask the user to enter the add or remove the following permission: read the user, write user, execute user, read group, write group, execute group, read other, write other and execute other. After file permission have been changed, display the file's new permission.

I am really stuck all day and been trying to solve it all day long.

Anyone who read my post. Thank you so much and really appreciate for ehlping me.

Last edited by Scott; 05-17-2010 at 01:23 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Debian

Execute permission problem

Hello, I need to install a program from a DVD. It uses a sh script called setup. root@ragnok: head -2 /media/cdrom0/setup #!/bin/sh root@ragnok: ls -l /media/cdrom0/setup -r-xr-xr-x 1 root root 4688 Nov 8 08:38 /media/cdrom0/setup root@ragnok: /media/cdrom0/setup bash:... (2 Replies)
Discussion started by: snorkack59
2 Replies

2. UNIX for Dummies Questions & Answers

How I acted as other can execute file which its permission is -rw-rw-r--

I am other user who want to execute a file that its permission is -rw-rw-r-- how do I execute that file. (2 Replies)
Discussion started by: thsecmaniac
2 Replies

3. Shell Programming and Scripting

How to execute a script without giving x permission to the file?

How to execute a script with out giving x permission to the file? (7 Replies)
Discussion started by: praveen_b744
7 Replies

4. UNIX for Dummies Questions & Answers

file permission problem

Hello I have situation where with my user id (group x) I am able to view a file. However if su to another user (different group) I am not able to view. I get permission denied. The file has complete wide open permissions -rwxrwxrwx and I can also cd from root to the directory in which the file... (3 Replies)
Discussion started by: akumargolf2000
3 Replies

5. Solaris

file permission problem

Hi Expert, Could you tell me what is the meaning of " + " as shown below: drwxr-xrwx+ /opt Thanks. (2 Replies)
Discussion started by: skully
2 Replies

6. Shell Programming and Scripting

Only Execute Permission for Others...

This might be very silly question but i dont know y is it so... i Have script I have Given the permissions in the following manner... -rwxrwx--x 1 root system 3 Jun 08 15:46 temp I want no one to see what is present in that but should be able to execute it.. but when... (3 Replies)
Discussion started by: pbsrinivas
3 Replies

7. UNIX for Dummies Questions & Answers

File Permission Problem

Hi,I am a newbie, in a hp-ux box,i create a file testfile as root, ls -l testfile -rw-r--r-- 1 root sys 1 Jan 11 17:51 testfile then l login the box as user ivan,then I execute rm testfile It prompts me testfile : 644 mode ? (y/n) ,if I enter y,then the testfile is... (11 Replies)
Discussion started by: bluepluto
11 Replies

8. Shell Programming and Scripting

without execute permission

how can a script run without execute permissions. when i run myscript as : sh a.sh it was working but when i say simple a.sh its not working since it has no x permission.but how about fist case? (1 Reply)
Discussion started by: Raom
1 Replies

9. UNIX for Dummies Questions & Answers

File permission problem

I have a crontab job that runs a database backup and directs the output to a log. I ran the job, and the output log file was created with no problems, but now if I try and run the same job again, I keep getting a file exists error. The permissions are: -rw-rw-r-- I also tried changing the... (2 Replies)
Discussion started by: jodie
2 Replies

10. UNIX for Dummies Questions & Answers

No permission to execute file

I am logged in as root and am trying to execute a file called x_cleanup_equdata but keep getting the message ksh: x_cleanup_equdataNEW: 0403-006 Execute permission denied. I did FTP this file from another server using GET, would this make the difference? I tried chmod 666 but still no luck. ... (2 Replies)
Discussion started by: markbeeson
2 Replies
Login or Register to Ask a Question