Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-01-2007, 01:49 PM   #1
Registered: Nov 2006
Location: Illinois
Distribution: Ubuntu 10.4
Posts: 35

Rep: Reputation: 15
Running a Script

Suppose I wrote a simple script, xyz, and it is in my home directory.

In order to run the script, I would type
and the script executes.

Why do I need the slash? Why not just

.xyz ?


./home/user/xyz ?

The latter two forms do not work.

Does the . (dot) represent "run" or "current directory"? If current directory, then why do I need the / (slash) if I am already in my home directory?

Thank you for any clarification.
Old 01-01-2007, 01:54 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
./ represents the current directory.

. by itself would make it a hidden file (the period would be part
of the filename).

The second form doesn't work because you don't have (most likely
you don't) home/user/xyz as a directory structure under your home.

Old 01-01-2007, 02:00 PM   #3
Senior Member
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch buster
Posts: 1,620

Rep: Reputation: 97

'.' means current directory or "./" means current directory.
'.xyz" is a file name which begins with '.' and is hidden. (ls -a can display hidden files)

If ./xyz in your home works, /home/yourname/xyz also works (the latter is "absolute path'), when ~/ is /home/yourname. (you cannot have '.' before '/')
xyz works when you have your current directory in shell variable "path", (I assume you use shell tcsh, ksh, zsh, bash... depending on your setting.)

Happy Penguins!
Old 01-02-2007, 12:55 PM   #4
Registered: Jun 2005
Posts: 202

Rep: Reputation: 35
Also take a look at permissions
$ chmod 755 xyz
$ xyz
for example
./ again specifies the path
have fun


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a script with another user brazilian_user Linux - General 8 10-18-2006 09:24 PM
running a .sh script bungle3 Linux - Software 3 10-03-2006 08:59 AM
Running a script spacemonk Linux - Newbie 4 07-30-2004 04:02 AM
Running a script file johnlb Linux - Newbie 2 02-19-2003 02:17 AM
c/c++ running a shell script? thermalpants Programming 3 05-12-2002 11:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration