The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
file permissions ranj@chn Shell Programming and Scripting 7 06-11-2008 12:37 PM
To give the "unzip" permissions & "create" file permissions Mike1234 HP-UX 3 03-02-2008 05:34 PM
help with file permissions bbbngowc Security 3 12-21-2007 01:34 PM
file permissions mohanprabu Shell Programming and Scripting 4 05-31-2005 10:19 AM
File and Dir permissions thomas.jones UNIX for Dummies Questions & Answers 11 04-19-2002 10:35 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-12-2006
beginner1 beginner1 is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 13
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.
  #2 (permalink)  
Old 04-12-2006
beginner1 beginner1 is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 13
Got it

ls -l file1 | cut -c 4-6


Is there a more efficient way?
  #3 (permalink)  
Old 04-12-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805
Not really. You can write a short shell script and then alias the script - if by "efficient" you meant a simpler user interface.
  #4 (permalink)  
Old 04-12-2006
beginner1 beginner1 is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 13
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 (permalink)  
Old 04-12-2006
dangral dangral is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2002
Posts: 699
*Note the backticks I inserted.


Code:
TMP=`ls -l file1 | cut -c 4-6`

  #6 (permalink)  
Old 04-12-2006
beginner1 beginner1 is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 13
It worked thank you.
Closed Thread

Bookmarks

Tags
grep or

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0