- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: source equivalent in HPUX
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
тАО04-09-2011 02:27 PM
тАО04-09-2011 02:27 PM
I am writing a script that work perfectly well in linux environment as it will run
source file.txt
Is there an HPUX equivalent as I need to include that file to the script?
Solved! Go to Solution.
- Tags:
- source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2011 02:43 PM
тАО04-09-2011 02:43 PM
Re: source equivalent in HPUX
uname -a
> I am writing a script [...]
With my weak psychic powers, I can't see it.
I can't even see its first line (the line
with the "#!").
> [...] linux environment [...]
uname -a
> Is there an HPUX equivalent [...]
No, but there's probably a _shell_
equivalent, if only we knew which shell(s)
you were using. if "source" doesn't work in
your shell, then I'd suggest ".":
. file.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2011 05:41 PM
тАО04-09-2011 05:41 PM
Re: source equivalent in HPUX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2011 05:51 PM
тАО04-09-2011 05:51 PM
Re: source equivalent in HPUX
Run what how, with . before what???
What, exactly, did this contribution actually
contribute here? Was your dot easier to read
than my dot? (And I thought that _I_ had too
much time to kill.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2011 07:39 AM
тАО04-10-2011 07:39 AM
Re: source equivalent in HPUX
On Linux and Apple systems, the 'bash' shell is the default shell. As such it has the 'source' as well as the 'dot' command, both of which do the same thing.
HP-UX's default shell is a POSIX shell closer to the Korn shell and found in '/usr/bin/sh' or '/sbin/sh' for 'root'. You can still specify an interpreter ("she-bang") line of simply '/bin/sh' since this is a symlink to '/usr/bin/sh' in HP-UX.
If you want to include a file (very commonly variable declarations and assignments) into another script, you speak of "sourcing" or reading it with the 'dot' command:
#!/bin/sh
...
# include the "mystuff' file here:
. /usr/local/bin/mystuff
echo "now continuing..."
...
Notice the 'dot' followed by whitespace, followed by the file to be included ('sourced' or read, whatever term you prefer).
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2011 11:12 AM
тАО04-10-2011 11:12 AM
Re: source equivalent in HPUX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2011 11:50 AM
тАО04-10-2011 11:50 AM
Re: source equivalent in HPUX
> As mentioned, "source" is used by the scummy C shell and its descendants. A real shell uses "." to source files.
While I wholly agree, when it comes to the "scummy C shell and its descendants", I'd certainly consider the Bash shell to be a "real shell" that can use *either* the 'source' command or the 'dot' command to achieve the same result.
Regards!
...JRF...
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-10-2011 11:15 PM
тАО04-10-2011 11:15 PM
Re: source equivalent in HPUX
I have tried the . dot to source file but it doesn't seem to work in my HPUX but work fine in Linux.
config.txt
HOST=myserver
script
#!/bin/sh
. config.txt
echo $HOST
I get the the config.txt not found error. Any idea why
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2011 12:15 AM
тАО04-11-2011 12:15 AM
Re: source equivalent in HPUX
>. config.txt
>I get the the config.txt not found error.
Why aren't you using an absolute path to config.txt?
Either it must be in $PATH or it must absolute or relative.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2011 12:24 AM
тАО04-11-2011 12:24 AM
Re: source equivalent in HPUX
for example, script.sh config.txt
it make the maintenance easier as I only need one script but many config.txt to cater for different server