- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- call shell script with . ./myscript.sh
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:21 AM
тАО12-20-2007 07:21 AM
Why sometimes some scripts needs to be call with the . ./myscript.sh syntax and sometimes with the ./myscript.sh ?
Thanks in advance
Regards
Den
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:25 AM
тАО12-20-2007 07:25 AM
Re: call shell script with . ./myscript.sh
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:26 AM
тАО12-20-2007 07:26 AM
Re: call shell script with . ./myscript.sh
In either case, the single period immediately preceding /myscript.sh means to look in the current directory.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:36 AM
тАО12-20-2007 07:36 AM
Re: call shell script with . ./myscript.sh
What could be the consequences to launch another shell ?
Regards
Den
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:41 AM
тАО12-20-2007 07:41 AM
Re: call shell script with . ./myscript.sh
sh-posix(1)
.
.
% . file [arg]...
(period) Read and execute commands from file and return. The
commands are executed in the current shell environment. The
search path specified by PATH is used to find the directory
containing file. If any arguments arg are given, they become the
positional parameters. Otherwise, the positional parameters are
unchanged. The exit status is the exit status of the last
command executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2007 07:46 AM
тАО12-20-2007 07:46 AM
Re: call shell script with . ./myscript.sh
The dot-space-filename (whether or not the filename contains a relative path of "./" means that you want to *source* or read the contents of the file into your *current* environment without starting a new shell (and thus losing the variable values).
Sourcing is done to pass environmental variables defined in a file into the environment of another:
# cat mythings
#!/usr/bin/sh
export NAME=Den
# cat someshell
#!/usr/bin/sh
. ./mythings
echo "I am ${NAME}"
exit 0
To see the difference, run 'someshell'; then change the line that reads:
. ./mythings
TO:
./mythings
...and run 'someshell' again.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-21-2007 12:29 AM
тАО12-21-2007 12:29 AM
Re: call shell script with . ./myscript.sh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2008 05:20 PM
тАО05-05-2008 05:20 PM