can't execute a shell script

Hi all,
As i want to know how the shell command "nohup" worked.I logged in as the user named vincent through Gnome.Then i press ctrl+atl+F1 changed into a console and logged in as another user named kinsley.The user "kinsley" is added by me with "useradd",and now there's no HOME directory for him(why?),and i have no right to make a new file.:wall:I moved a script which is owned by vincent to the directory of kinsley,and changed the file mode and ownership like this:

-rwxr-xr-x 1 kinsley kinsley 43 2011-03-06 21:53 /home/kinsley/script

and the file mode,ownership of /home/kinsley is

drwxr-xr-x 3 kinsley kinsley 4096 2011-03-06 21:56 /home/kinsley

The problem is i was NOT able to execute this script as kinsley.
The context of that script is:

#! /bin/sh

while .;do
	sleep 5
	date
done

why can't i execute this script?

You logged in as someone who had no home directory, and despite not being able to create a file, you copied a file called "script" into that directory?

So you copied a file, something you are unable to do, to somewhere that didn't exist?

What error did you get (aside from the invalid . in the while loop - that you wouldn't see, as you couldn't execute the script!)? Which OS are you using?

I created the directory /home/kinsley for kinsley before i copied the script into that directory.I didn't not get any output and error code while i executing that script,it looked like an endless loops without any output.The dot after while means TRUE In bash shell,isn't it?I use ubuntu 10.10 2.6.35-22-generic

A : would mean "true". I tested a . in bash (not in Ubuntu) and it throws an error.

If your user was missing a home directory, you probably just forgot to specify it when running useradd.

You obviously resolved that using mkdir, chown and chmod.

I'm confused (it doesn't always take much to confuse me!), but where exactly is your problem, and what has nohup to do with it? (except that if you had run it nohup, the output would go to nohup.out by default)

You said you couldn't execute the script, but clearly you can if it's an infinite loop.

Try changing the . to a :. Otherwise perhaps you have an alias for date that's expecting some input (that would make the script seem "infinite")?

sorry i make a fool mistake....In my script,the sleep time was set to be very long as a careless mistake.So i thought it wasn't executed....:wall: what a fool i am.....Anyway,thanks for your help

---------- Post updated at 10:21 AM ---------- Previous update was at 10:17 AM ----------

Thanks,all your words here are right except about ".".Now i realized the : means true,however,my code runs well when i still use "." as a test :eek:

In hindsight, if I remember, #!/bin/sh in Ubuntu is a link to dash, not bash. Maybe that's why . didn't work for me.

you are my idol!!!

lrwxrwxrwx 1 root root 4 2010-11-24 03:09 /bin/sh -> dash