Command to find permission in octal value

Hi All,
Is there a way to find out the permission of a file in octal value. ls -l will give in rwx format. But I need this in octal format like 655. To explain the use case,
When i start a script I need to get the permission of file and store it in a variable. Will change the permission of the file during the script execution. The last command in the script should revert back the permission of the file. I am using chmod for doing the same. When I google, I saw a command like stat, but this seems to be C module. Is there any way to do the same using standard commands.
Thanks In Advance,
Veerabahu

stat is also a command commonly installed on Linux, but it doesn't come with Solaris 9. You could compile and install it.
I'd probably use perl for my script, then you can call stat directly within perl while you're doing things.
#!/usr/bin/perl
my $file = "/tmp/file";
my $new_mode = 0421;
my $orig_mode = (lstat($file))[2] & 07777;
printf "Current mode of file is %o\n", $orig_mode;
system ("ls -l $file");
printf "Changing mode to %o\n", $new_mode;
unless (chmod $new_mode, $file)
  { die "chmod of $file failed.  $!\n"; }
system ("ls -l $file");
printf "Changing mode back to original (%o)\n", $orig_mode;
chmod $orig_mode, $file;
system ("ls -l $file");--
Darren

Similar Messages

  • Whenever I close down Photoshop CS5 I get the message: "Could not save Preferences because the file is locked or you do not have the necessary access privileges. Use the get info command in Finder to unlock the file or change permission on the file or enc

    Whenever I close down Photoshop CS5 I get the message: "Could not save Preferences because the file is locked or you do not have the necessary access privileges. Use the get info command in Finder to unlock the file or change permission on the file or enclosing folders." What on earth does it mean? How can I stop this message from appearing?

    See here:
    I cannot save recent images.

  • Default seetings for a (command-f) find?

    Hello,
    First off, I'm new with Tiger so I suppose my first question would be is doing a command-f (find) the same as using spotlight?
    That being said, the search option box that opens when you do a (command-f) find—is it possible to set default search locations (ie. i'd like it to also check a network drive as well by default)?
    Thanks,
    Kristin.

    First, yes command-F now uses Spotlight.
    Second, there is no good way to change the default find yet. There was a long opinion piece on MacWorld recently (http://www.macworld.com/news/2005/11/15/spotlightanlaysis/) that details the rough edges of Spotlight as it is currently implemented which you might find interesting.
    In any case, the closest you can currently come without a lot of work is using the Smart Folders feature to save a search with the settings you prefer. Then to search those settings again, you can open the Smart Folder and change the search value. (Use the "Others..." tab to select specific volumes for your search, btw.)
    EDIT: BTW, I forgot to mention, there is a good Spotlight tips article linked off that first one I mentioned: http://www.macworld.com/2005/09/features/tigertips2/index.php.

  • Give SQL command to find the average annual salary per job in each department

    Give SQL command to find the average annual salary per job in each department pls help

    with
    data as
    (select empno,deptno,job,payday,1000 + trunc(500 * abs(dbms_random.normal)) + decode(deptno,10,500,11,200,12,100,0) salary
       from (select 1000 + trunc(dbms_random.value(10,100)) empno,
                    10 + floor(dbms_random.value(1,10) / 4) deptno,
                    decode(trunc(dbms_random.value(1,10)),1,'A',2,'B',3,'C',4,'D',5,'E',6,'F',7,'G',8,'H',9,'I','?') job
               from dual
             connect by level <= 17
            (select add_months(to_date(to_char(level),'mm'),-12) + 10 payday
               from dual
             connect by level <= 12
    select deptno,job,avg(salary) average_salary
      from data
    group by deptno,job
    order by deptno,job
    DEPTNO
    JOB
    AVERAGE_SALARY
    10
    B
    1812.83333333333333333333333333333333333
    10
    F
    2046.08333333333333333333333333333333333
    10
    G
    1877.45833333333333333333333333333333333
    10
    I
    2081.75
    11
    C
    1456.08333333333333333333333333333333333
    11
    E
    1654.91666666666666666666666666666666667
    11
    G
    1650.5
    11
    I
    1579.33333333333333333333333333333333333
    12
    A
    1580.58333333333333333333333333333333333
    12
    E
    1414.33333333333333333333333333333333333
    12
    H
    1380
    12
    I
    1404.83333333333333333333333333333333333
    Regards
    Etbin

  • Warning: Could not find the customization level value for document

    Hi All,
    I am trying to upload the translation for one of the page at responsibility level.
    I am getting following warning when running the below command.
    java oracle.jrad.tools.trans.imp.XLIFFImporter $APPL_TOP/xmci/12.0.0/fr-CA/Translated/ARIACCTDETAILSPAGE.xlf -username apps -password apps -dbconnection "$AD_APPS_JDBC_URL"
    Warning: Could not find the customization level value for document "/oracle/apps/ar/irec/accountDetails/webui/customizations/responsibility/51688/ARIACCTDETAILSPAGE".
    The same is working fine if the translation is for some attribute at site or function level.
    Did anyone faced this kind of issue.
    Thanks,
    Anoop

    Anoop,
    I am sure you would have verified the responsibility id in the target instance is 51688(may be source instance your resp id is 51688 and in target it is different).
    Have a look at this below notes, it might help.
    1077267.1 - Unable To Move Resp Level OA Personalization From 1 Env To Another
    848851.1 - Attempting To Upload XML File Generates Error: Could not find the customization level value for document
    Thanks.
    With Regards,
    Kali.
    OSSI.

  • A command for finding an application's version number?

    Hello,
    I need a command for finding the version number of a specific application installed in OS X, and I need to be able to run it via the UNIX feature of Apple Remote Desktop, so that I can run it on hundreds of computers. First I tried this:
    system_profiler -detailLevel full
    It works, but it takes a long time to produce the output, because it's gathering and outputting all of the information that System Profiler provides. I don't know if there's a way to narrow it down so that it only gives me the version number of the specific application I need to know about. This is an example of what the output looks like for each application listed.
        iPhoto:
          Version: 9.2.1
          Last Modified: 10/27/11 10:05 AM
          Kind: Intel
          64-Bit (Intel): No
          App Store: No
          Location: /Applications/iPhoto.app
    Copying that to TextEdit and searching for the application's name takes way too long, especially for hundreds of computers. Are there any arguments or regular expressions I could add to the command to narrow it down, and make it only output the information I need?
    Someone suggested this command, which takes the information from Spotlight:
    mdls -name kMDItemVersion <path to file>
    That works for apps in the Applications folder, but the application I need the version number for is in the /usr/bin folder and I'm guessing that's not indexed by Spotlight, because it returns:
    kMDItemVersion = (null)
    Any help would be greatly appreciated!
    -Mike

    You rock! I'm definitely on the right track now. Yes, it's a regular application package, not a UNIX executable. Ok, so I use this command to display the Info.plist file inside that package:
    cat /usr/bin/uc/UndercoverRegistration.app/Contents/Info.plist
    And it outputs this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
        <string>UndercoverRegistration</string>
        <key>CFBundleIconFile</key>
        <string>Undercover</string>
        <key>CFBundleIdentifier</key>
        <string>com.orbicule.UndercoverRegistration</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>4.5</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>4.5</string>
        <key>NSMainNibFile</key>
        <string>MainMenu</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>
    </dict>
    </plist>
    So can I add arguments to that command to have it only display the version number, which is on line 18 (the value is 4.5 here)? So would I be able to display only line 18, or display whatever is below the line that reads "<key>CFBundleShortVersionString</key>"? Thanks!

  • How To Find Opening Stock And Value For a Material

    Hi Experts,
    How To Find Opening Stock And Value For a Material  in Given Dates
    Moderator Message: Search.
    Edited by: kishan P on Sep 15, 2010 4:05 PM

    Thanks For Answering.....
    But I Need Any Function Module To Get Opening Stock And Value For Given Material With in Dates.

  • Function Module to find out the release value in contract

    Dear All,
    I have to upload the contract with new accoutn assignment without changing the existing contract. For that i have to download all the existing contract data with value.
    In that case i have some issues regarding the value.
    For example : In the system old contract is created with value 1000 and the released value as 500.
    In that case i have to uload the new contract with all the details of existing contract with value of 500 (1000-500=500).
    How can i get the value (500) and from which table.Is there any functional module to find out the release value in contract.
    Thanks and regads,
    PM
    Edited by: PM on Jan 21, 2010 8:40 AM
    Edited by: PM on Jan 22, 2010 9:48 AM

    Hi
    You need to link the table VBFA and VBAK.
    For a contract you can check all the subsequent document (which you can filter whether you want to see Order / delivery / Billing) in VBFA and then from there pick the subsequent document no. and then from VBAK you can pick the Net value of these subsequent documents, and so you will have both the values (value of Contract and value in subsequent document) and you can determine the balance value.
    Regards
    Amitesh Anand

  • Could not find selected item matching value "null" in CoreSelectOneRadio

    Hello,
    I get the following error with my selectOneChoice components:
    WARNING Could not find selected item matching value "null" in CoreSelectOneRadio[UIXEditableFacesBeanImpl, id=dyna_2709976_11]
    It seem that the component looks for a selectItem object qith its value set to null, so I tried to add one with a null value to no avail. The error don't cause any problem on the rendered page but it might spam the log when many users will be connected. Anyone every got this error and found a fix to stop it from appearing?
    Regards,
    Simon Lessard

    you said you're using selectOneChoice but the error says radio. Is the information correct?

  • Could not find selected item matching value "New" warning message in ADF

    Hi,
    I have a selectOneChoice1 for a field which has the following fixed values in it. And while creating it, I selected the 'SelctionRequired' option so that this field will always have a value.
    New
    Pending
    Completed.
    While navigating to this page, I am trying to set the value to 'New' (Retrieved from the DB) in the backing bean. But when the page is rendered, the above field is empty with the above options in the list and jdev has the follwing error message in its log.
    WARNING: Could not find selected item matching value "New" in CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=selectOneChoice1]
    Can any one help me with this issue?
    Thanks,
    Priya

    The value of a list binding is the zero-based integer position in the list that is selected, not the actual underlying value.
    The simplest way to set the value of an attribute is to use an attribute binding (which can be bound to the same attribute as the list binding). When you set the value of an attribute binding, it sets the value as you supply it. Otherwise, you'd need to set the list binding's value to the numerical "slot" number of the one you want to change the value to.

  • How to find out the ASCII Values for Spanish character

    Hi,
    I had an requirement to store Spanish character and also need to fileter the records based on the Spanish character.
    Kindly guide me for below.
    To filter the Records which contains spanish characters?
    To get the ASCII Values for the particular column?
    E.g. we can find out the ASCII value of 'a' by using the syntax select ASCII('a') from dual.
    But I want to find the ASCII Values for the particular column value. Ie. name.
    E.g., Client name is "Suresh", I want to the ASCII Values for entire name of "Suresh".
    Kindly do the needful help / Guidance on this.
    Thanks,
    Orahar

    To expand on what I said in my first post, you want to do something along these lines:
    with t (thename) as
      select 'Suresh' from dual
    select thename
         , substr(TheName, level, 1)
         , ascii(substr(thename, level))
      from t
    connect by level <= length(thename);The output of the above query is:
    THENAM S ASCII(SUBSTR(THENAME,LEVEL))
    Suresh S                           83
    Suresh u                          117
    Suresh r                          114
    Suresh e                          101
    Suresh s                          115
    Suresh h                          104
    6 rows selected.Note that the WITH statement is only there to simulate a table for this example. With a table, all you do is get rid of the with and substitute the name "t" for the name of your table (also the name of the column to whatever name the column has in your table).
    Lastly, I suggest you post your question along with, an example table and the output you'd like to get in the PL/SQL forum. There are people there that will give you all kinds of great ways of solving that problem.
    HTH,
    John.

  • Command to find File versions in Linux

    Will any one tell me the command to find the file versions of the following files:
    - POXVDCKB.pls
    - POXWPA9B.pls
    I am new to Financials app. Thanks in advance
    Regards,
    BMP

    oa.jsp is helpful in determining the version of Self Service Framework you are using. To check that out, use the table listed below:
      OA.jsp Version    Framework Version   Patch Number
         115.61           11.5.10.5RUP         5473858
         115.60           11.5.10.4RUP         4676589
         115.58           11.5.10.3RUP         4334965 / 5125546
         115.56           11.5.10H             3262919
         115.39           11.5.10G             3516965
         115.36           5.7H                 2771817 (11.5.9)
         115.27           5.6E                 2278688 (11.5.8)
         115.26           5.5.2E               2227335
         115.20           5.5.2C               2085104
         115.19           5.5.2B               2041847
         115.11           5.5.1E
         115.10           5.5.1B
         115.9            5.5.1A
         115.8            5.5.0E
         115.7            5.5.0D
         115.6            5.5.0C
         115.5            5.2.3D
         115.4            5.2.3C You can also check the version of OA Framework you currently have installed by logging in to your 11i instance and navigate to OAInfo.jsp using the following:
    http://hostname.domainname:port/OA_HTML/OAInfo.jsp

  • Does the 10.5.7 update address command+f finder search issues?

    Does the 10.5.7 update address command+f finder search issues?
    Search has been horrible under 10.5 in that it does not reliably find FOLDERS on network drives, only file names.
    Even when I am looking directly at a folder and I search for it will not appear in the command+f window.
    Also the stupidity of not allowing a specific search location.
    Has this been addressed? I have, at any given time, 3-4 mounted servers.
    I do not have a choice now to search a specific hard drive.
    10.4.11 gave me the option under "OTHERS" to select a specific place to search.
    The only choice I have in 10.5.2 is "SHARED". Which searches all drives when I only want to search one. Nor do I have a choice of searching just one of my two internal drives.
    I talked with Chris in apple engineering several months ago, who acknowledged that search problems are a known issue under 10.5 and this was being addressed but have not heard any more. I don't want to download an update unless these broken search issues have been fixed. This is a production machine and I cannot have downtime in the Dept.

    Have you filed a bug report or enhancement request with Apple?
    http://bugreport.apple.com/

  • How we can find out the default value of the initialization parameters

    Hi All,
    How we can find out the default value of the initilization parameters from oracle database.
    Thanks
    Shiju

    Hi,
    you can find currently used parameter values v$parameter and v$parameter2.
    if default values is different real values then you can see alert.log.
    because in alert.log you will see non default values, rests is default.
    Edited by: admin on May 8, 2010 3:41 AM

  • How to find if COLUMN DEFAULT VALUE is stored as metadata?

    Hello,
    I'm using Oracle 11g enhanced ADD COLUMN Functionality. Adding new columns with DEFAULT values and NOT NULL constraint no longer requires the default value to be stored in all existing records.
    Sometimes we change DB columns from NOT NULL with DEFAULT to NULL with DEFAULT. This operation "materialize" column default.
    Is there an easy way (Dictionary view) how to find, that COLUMN default value is stored as metadata or is "materialized" ?
    Thanks. Filip
    Oracle RDBMS version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Thanks for your suggestion, but it is not what i'm looking for :-(
    I don't need to find the default value, i need to know how is default value stored. It could be stored in 2 ways.
    1. "materialized" - prior to 11G (value is physicaly stored for every column)
    2. "as a metadata" - new 11G functionality (default is not physicaly stored and if you query the column DB transalte NULL value to defaut value)
    Now I would like to now if my column is type 1) or 2). How can I do it?
    Thank you.Filip

Maybe you are looking for