Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Command line octal file permissions
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
config
features
lib
spec
.gemfiles
.gitattributes
.gitignore
.yardopts
Gemfile
Gemfile.lock
HISTORY.markdown
LICENSE
README.markdown
Rakefile
TODO.markdown
VERSION
oct.gemspec

README.markdown

Oct

Command line octal file permissions

Why?

Oct is a sample RubyGem application cloned from BasicApp. See http://github.com/robertwahler/basic_app for more information.

Oct does scratch an itch. 'Chmod' is easier to drive in octal and I can't convince 'ls -l' to output permissions in octal.

Here is an equivalent bash script

#!/bin/bash
# octal file listing

if [ "$1" == "" ]
then
  PARAM="*"
else
  PARAM="$@"
fi

for file in $PARAM
do

  if [ ! -e "$file" ]       # Check if file exists.
  then
    echo "$file does not exist."; echo
    continue                # On to next.
   fi

   stat --format='%a,%U,%G,%t %n' $file
done

Run-time dependencies

Development dependencies

Installation

This gem has been published on RubyGems.org

gem install oct

Usage

oct --help

Octal file listing

  Usage: oct [options] [FILES]

Options:

    -v, --[no-]verbose               Run verbosely
    -c, --[no-]coloring              Ansi color in output
        --version                    Display current version
    -h, --help                       Show this message

Example

ls -l

total 0
-rw-r--r-- 1 robert robert 0 2010-03-12 10:37 file1.txt
-rw-r--r-- 1 robert robert 0 2010-03-12 10:37 file2.txt

oct

0644 file1.txt
0644 file2.txt

Copyright

Copyright (c) 2010-2011 GearheadForHire, LLC. See LICENSE for details.

Something went wrong with that request. Please try again.