User Profile

Collapse

Profile Sidebar

Collapse
thaiZilla
thaiZilla
Last Activity: Jan 23 '08, 08:30 PM
Joined: Jan 15 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • thaiZilla
    started a topic Help on this loop

    Help on this loop

    userlist=`who | cut -d " " -f1`
    linetotal=`cat $userlist| wc -l`
    linenumber='1'

    while [ $linenumber -le linetotal ]
    do
    username=`somestuff` put that in for now

    basically i want the username variable to be equal to the first line from who | cut -d " " -f1`...and from the loop move to the next line of `who | cut -d " " -f1` and so on until the loop is cleared......
    See more | Go to post

  • thaiZilla
    replied to Readin File permissions?
    Hey thanks for your reply. However i've not used awk or sed before and i'm not suppose to use it for this exercise. The full task is to use a file as an argument then display the permissions in a certain format like so :-

    READ WRITE EXECUTE
    OWNER LEE.BALLANCORE YES YES NO
    GROUP USERS YES NO NO
    EVERYBODY NO NO NO
    ...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    started a topic Readin File permissions?

    Readin File permissions?

    How do i read a file permission?

    i know that ls -l *filename* will list all information about the file including file permissions eg -rwxr-xr-x 1 norman.thai users 187 Jan 15 10:33 firstline...

    how do i read just the file permission tho to use be used as a variable...
    -rwxr-xr-x

    i also understand that the file permissions can be read as binary 000 000 000...
    See more | Go to post

  • thaiZilla
    replied to Listing logged on users
    Thanks very much Paul, thats the type of help i wanted. I'll get cracking on it and i'll pm you my answer sometime next week for your confirmation. Thanks again much appreciated....
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Unix Adding Text to corresponding lines...
    Ahhh thanks very much, much appreciated!...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Unix Adding Text to corresponding lines...
    Hey thanks for your time, both codes you provided for me work, i vaguely understand the last one...i just don't understand why my tutorials would ask me to look at loops.

    If you have any time could you explain the nl -s\ command and w1 in your coding - (rm file&&nl -s\) -w1>file)<file

    Thanks again you have been helpful...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Unix Adding Text to corresponding lines...
    i was told to look into loops. I'm new tho i'll have a crack at what you put in....
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Listing logged on users
    Have a look at what i get:-

    [norman.thai@uni x ~]$ ps -U norman.thai
    PID TTY TIME CMD
    9681 ? 00:00:00 sshd
    9682 pts/23 00:00:00 bash
    9711 pts/23 00:00:00 ps
    [norman.thai@uni x ~]$ w
    14:07:31 up 1 day, 4:47, 24 users, load average: 0.14, 0.12, 0.10
    USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
    amol.pan pts/1 82.28.49.174 14:03...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Listing logged on users
    I'm gona emphasise this again...this is not homework i have graduated and for a job i require to understand unix further. They have given me an online tutorial and have suggested excercises to carry out...and i am unable to do them.

    So far you have critcised my knowledge. ps -U *username* structures the required information the way i want it to...however does not show me the list of all users in that foramt...

    my second...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Unix script for permissions
    My latest attempt is :-

    ls -la|grep " $1"$ | tr "\t" " " | tr -s " " | tr " " "\n" > tfile
    permissions=$(h ead -1 tfile)
    owner=$(head -3 tfile|tail -1)
    rm tfile
    powner=$(print -- $permissions|cu t -c 2-4)
    pgroup=$(print -- $permissions|cu t -c 5-7)
    pusers=$(print -- $permissions|cu t -c 8-10)
    print Filename: $1
    print...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    started a topic Listing logged on users

    Listing logged on users

    I want to create a file that shows all the users logged into the system and their processes. I've tried using the w command...this lists a little too much information...s o i tried using

    ps -U *myusername* but that only gave me my current logged on status in the following correct format:-

    PID TTY TIME CMD
    31799 pts/3 00:00:00 vim
    31866 pts/3 00:00:00 vim
    2495 pts/7 00:00:00 vim
    8368 pts/0...
    See more | Go to post

  • thaiZilla
    started a topic An alternative to this code?

    An alternative to this code?

    Does anyone know an alternative to this without the use of awk or a tmp file. I'm starting from the basics and awk seems a wee bit too advanced at this early stage. Kind regards.

    awk '$0=++c")"$0' file>_tmp&&mv _tmp file

    i have a feeling i need to use a loop.
    See more | Go to post

  • thaiZilla
    replied to Unix script for permissions
    Hi Jeff, thanks for the reply.

    This isn't homework, its an exercise apparrently designed to further my learning. However i'm not learning. I've been asked to further research on how to code this. Let me add, i am a complete newbie to unix. I'm familiar with the bash interface but scripting i'm finding hard to grasp. So far from my online training i've come across the the chmod command which is for permissions. I understand echo will...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    replied to Unix Adding Text to corresponding lines...
    Is there a method without awk cos i'm learning from the basics and i've used tmp files before but i want a way without using a tmp file. Thanks...
    See more | Go to post

    Leave a comment:


  • thaiZilla
    started a topic Unix script for permissions

    Unix script for permissions

    How do i write a script that takes a file as an argument and determines what permissions the owner, group and everybody has for the file?

    I want to view roughly like this.
    READ WRITE EXECUTE
    OWNER MATT.BALLANCORE YES YES NO
    GROUP USERS YES NO NO
    EVERYBODY NO NO NO
    See more | Go to post

  • thaiZilla
    started a topic Unix Adding Text to corresponding lines...

    Unix Adding Text to corresponding lines...

    grep $USER xx >> filenorman.thai

    i used the above command to gain a searched list for a user and put it into a file called filenorman.thai , the following is a bit of its contents...

    USER=norman.tha i
    MAIL=/var/spool/mail/norman.thai
    PWD=/home/norman.thai
    HOME=/home/norman.thai

    My question is, how do i add the corresponding line number as well as a bracket to make the text look...
    See more | Go to post
No activity results to display
Show More
Working...