![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| file permissions | ranj@chn | Shell Programming and Scripting | 7 | 06-11-2008 08:37 AM |
| To give the "unzip" permissions & "create" file permissions | Mike1234 | HP-UX | 3 | 03-02-2008 02:34 PM |
| help with file permissions | bbbngowc | Security | 3 | 12-21-2007 10:34 AM |
| file permissions | mohanprabu | Shell Programming and Scripting | 4 | 05-31-2005 06:19 AM |
| File and Dir permissions | thomas.jones | UNIX for Dummies Questions & Answers | 11 | 04-19-2002 06:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
File permissions
Is there any way that I can use the ls command to view the permissions that a group has on a file.
I know ls -l file1 will list all the permissions for file1. Would I have to use the following command: ls -l file1 Then grep or sed the output to retrieve what permissions the group has. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Got it
ls -l file1 | cut -c 4-6 Is there a more efficient way? |
|
#3
|
|||
|
|||
|
Not really. You can write a short shell script and then alias the script - if by "efficient" you meant a simpler user interface.
|
|
#4
|
|||
|
|||
|
How do I assign the results to a variable.
I have tried the following but it doesnt work TMP= ls -l file1 | cut -c 4-6 This just seems to output the file permissions to the screen, whereas I want the result stored to TMP so that I can perform an If statement on it. |
|
#5
|
|||
|
|||
|
*Note the backticks I inserted.
Code:
TMP=`ls -l file1 | cut -c 4-6` |
|
#6
|
|||
|
|||
|
It worked thank you.
|
|||
| Google The UNIX and Linux Forums |