unix very simple

Posted on 2009-12-29
Last Modified: 2013-12-26
I have a ksh file in a directory mydir/ and the name of file is test.ksh
and I am right now logging in as a different group using
sudo su -appuser
and then when I do pwd , I am in directory called  exp/home/appuser
Now I need to run the script called test.ksh from here How do I do that
Question by:Sara_j_11
    LVL 84

    Accepted Solution


    Author Comment

    also what is happening is : when I logon using sudo su -appuser and then go to the directory called
    /groupdirectory and then try to run the test1.ksh using ./test1.ksh, what is happening is - the 2 sqls that I have is running fiine- is able to connect to oracle and execute fine. But after that the ksh file has a line where it calls a sas porgram , the code calls it fine(i could see it since I put a set -x before that line.
    But when I look in the log file of the sas program , there is an error saying that :::::


    Can you please help me figure out what type of an issue is this. I am 100% positive that there is no issue with the sas program , since I ran that fine by logging in as me(sara) and then going to that directory called /groupdirectory and then I did a ./test1.ksh. and the ksh file that calls the sas script ran without any issues.....

    Author Comment

    ok I found out what it could be , I think I need to change the permissions on mydirectory
    in the path
    teh permissions needs to be drwxrwxr-x  .
    Whqat is the chmod command for it. is it chmod go=rwx /mydir

    But I want teh files inside the directory /mydir to also have the  same permissions as /mydir
    how do i recursively do this?
    LVL 40

    Assisted Solution

    the right command is

    chmod -R ug=rwx /mydir

    the o here refers to others and not owner, while u refers to owner
    LVL 1

    Assisted Solution

    You can also use octal permissions... which some people find more obvious.

    "chmod 775  /mydir" would change it to rwxrwxr-x  

    user,group=7 octal=111, other=5 octal=101, r-x

    the "o" and "u" are confusing because they refer to "other" and "user"... The concept of owner didn't evolve until much later.
    LVL 48

    Assisted Solution

    When you do (fixed the missing space for you)

    sudo su - appuser

    You are switching to another user (in affect, logging in as that user).  You can change groups within your own user with the 'newgrp' command (Note that you can only change to a group to which you are a member of)

    LVL 1

    Expert Comment

    One last point about the "-R" option.  I really hate text files that are flagged as executables, so this is how I tend to do it;

    % find /mydir -type d -print | xargs chmod 755% find /mydir -type f -print | xargs chmod 644
    All directories would be: rwxr-xr-x
    All files would be: rw-r--r--

    find and xargs are two commands at the top of my use list.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now