Unknown Problem. I really want your help to solve this!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unknown Problem. I really want your help to solve this!
# 8  
Old 05-11-2010
yeah $USER is a system variable. Is the name (alex, george, root or anything) of the person who ran the script.
Thx for your answers I'll try them out and then I'll let you know.

Last edited by hakermania; 05-11-2010 at 02:06 PM..
# 9  
Old 05-11-2010
Not on my system or any unix system I have seen.
The basic environment variables set on login are usually listed in "man login". Of course this might not be unix or the variable might be set in /etc/profile or the user .profile .... ?

What Operating System do you have?
If you login normally do you get a value in $USER for both a "root" and a normal user ?
# 10  
Old 05-11-2010
As for Corona688's question, the program is supposed to scan some things in every user separately and print the results in the $current directory, unless there is any folder or file in the $current directory (if you noticed, the $current directory is the dir from where the script was executed)

---------- Post updated at 12:05 PM ---------- Previous update was at 12:03 PM ----------

methyl, it is a system variable. Look this:
Image
# 11  
Old 05-11-2010
Quote:
Originally Posted by methyl
Not on my system or any unix system I have seen.
The basic environment variables set on login are usually listed in "man login". Of course this might not be unix or the variable might be set in /etc/profile or the user .profile .... ?

What Operating System do you have?
If you login normally do you get a value in $USER for both a "root" and a normal user ?

I have checked on HP-UX,Solaris and Linux. its there.
But yes, it is not listed in man login and as said, I have found this in /etc/profile.

Code:
if [ -x /usr/bin/id ]; then
        USER="`id -un`"
        LOGNAME=$USER
        MAIL="/var/spool/mail/$USER"
fi

We shouldn't refer this as a environment/system variable. But the point is, do we generally edit the /etc/profile?
# 12  
Old 05-11-2010
Quote:
Originally Posted by hakermania
As for Corona688's question, the program is supposed to scan some things in every user separately and print the results in the $current directory, unless there is any folder or file in the $current directory (if you noticed, the $current directory is the dir from where the script was executed)
More detail please? I'd just get the needed info from your program if I knew it worked, but currently it doesn't, and if it did you wouldn't be asking anyway. Plus there's no sample data at all.

Last edited by Corona688; 05-11-2010 at 02:25 PM..
# 13  
Old 05-11-2010
Sorry, I don't want to give further information about it Smilie
I don't think that's up to the point to solve the problem, because it hasn't to do with this.... Anyway, I have to say that the program was working fine. Only when root user ran it twice then the output was full of errors (because then it couldn't overwrite the files and the folder that were created). One solution is to force-copy the file (overwrite the existing) but i want to avoid the script to do all this searching to collect info about each user and then to overwrite the already existing folders and files. I wanted to avoid this and then I tried to make this code in case the user is root to recognize if there is any folder or file with a user's name in the same folder and then run something else immediately.... it is simple.

The program runs something if there information isn't there and then runs the ./runit
If the things that wanted to collect are there then avoid collecting the info and run .runit immediately! Simple...
The thing is that I cannot locate my error!
# 14  
Old 05-11-2010
Quote:
Originally Posted by hakermania
I don't think that's up to the point to solve the problem, because it hasn't to do with this. Anyway, I have to say that the program was working fine. Only when root user ran it twice then the output was full of errors (because then it couldn't overwrite the files and the folder that were created).
Forgive my bluntness but, with the script as written, "working" is a tenuous condition. So long, hope you get it working right.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help me solve this scripting problem please

Hello, I would really appreciate some help into approaching this problem: - i have a random txt file with x lines and y rows following this pattern: ex: ip1 | user1 | command ip2 | user2 | command ip3 | user3 | command - i need to telnet/ssh into these ip's, login with... (7 Replies)
Discussion started by: catalinstk
7 Replies

2. Shell Programming and Scripting

How to solve the problem of overwriting an array?

Hi all, I have a file..... I want to print 2nd column arranged according to order of first column, present in second file..... So, the output should be: I am using following code: awk 'NR==FNR{a=$2;next}{print a?a:"ABSENT\t"}' file1 file2 But, it seems that the... (3 Replies)
Discussion started by: CAch
3 Replies

3. UNIX for Advanced & Expert Users

how would you solve this problem?

I have a file process.txt I wanted to just grab data in "process" column. Name process process_id status Adminserver adminserver 22669 Running Browser Engine browserengine ... (7 Replies)
Discussion started by: soemac
7 Replies

4. IP Networking

Need to solve complex network problem

I have a Red Hat linux server X on a x.x.0.0 network. This machine also has to communicate with another server Y on a network called y.y.0.0 Server X has two network interfaces. eth0 is configured on the x.x.0.0 network and has a default gateway on the x.x.0.0 network. In order to... (4 Replies)
Discussion started by: soliberus
4 Replies

5. UNIX for Advanced & Expert Users

How to solve restarting problem

Hi! My unix os version is OSF1 CP1 V4.0 878 alpha. It startup normally but it restarts within 5 sec. I would like to know how to solve . Please reply to me. Thanks . akzin (2 Replies)
Discussion started by: akzin
2 Replies

6. UNIX for Advanced & Expert Users

use two unix commands to solve the following problem

Hi, all, The following commands could compute the 10 most frequent bigrams from a input sequence which is in a file infile. I would like to know whether there is somebody who can use only two unix commands to do the same work. -------------------- tr " " "\012*" <infile >out1 tail +2... (3 Replies)
Discussion started by: vicky20000
3 Replies

7. Programming

Can any one solve this Problem...!!!

Try to solve this.....It's a nice program..... #include<stdio.h> void change() { /*Write something in this function so that the output of printf in main function should give 5 . Do not change the main function */ } void main() { int i=5; change(); (9 Replies)
Discussion started by: Baba B. Saheb
9 Replies

8. UNIX for Advanced & Expert Users

can't solve that problem [PLEASE HELP]

well, my internet brakes down every day because of my server, i don't have troubles with RAM or anything i think... that problem started since i am running an unrealircd server... well, my internet brakes down and when i try to access the inside ip from the server on http port 80, it says that:... (2 Replies)
Discussion started by: AiRkO
2 Replies

9. Programming

How can I solve this problem?

I'm now designing a server application which can serve large number of clients' request. I've a question to ask, that is, main process will block when invoke the "accept" function, if a client request comes, main process should be separated into 2 processes by invoking "fork" function, the parent... (4 Replies)
Discussion started by: acqy
4 Replies
Login or Register to Ask a Question