Hi,
I have a simple script to automate turning text files into scripts.
Operating on a file, it should make it executable, copy it to a script location that is in my $path variable, and then rehash so it is immediately available.
Everything except the "rehash" is working from the script. However, it I manually rehash after running it, it works. Whats up?
<BEGIN SCRIPT>
#!/bin/tcsh
chmod 755 $1
mv $1 /TerminalScripts/
rehash
<END SCRIPT>
Thanks!
--
Jeffrey A. Hawkins
Information Systems Supervisor
Humanities Software, a division of Renaissance Learning, Inc.
In article <yE2Pa.37772$C83.3073630@newsread1.prod.itd.earthlink.net>,
<JHawkins@HumanitiesSoftware.Com> wrote:
Hi,
I have a simple script to automate turning text files into scripts. Operating on a file, it should make it executable, copy it to a script location that is in my $path variable, and then rehash so it is immediately available.
Everything except the "rehash" is working from the script. However, it I manually rehash after running it, it works. Whats up?
<BEGIN SCRIPT>
#!/bin/tcsh
chmod 755 $1
mv $1 /TerminalScripts/
rehash
<END SCRIPT>
Thanks!
--
Jeffrey A. Hawkins
Information Systems Supervisor
Humanities Software, a division of Renaissance Learning, Inc.
The problem is that the wrong instance of the shell is getting the
rehash. Your shell is firing up another instance of the shell (another process) to run the script. And it's that second shell that does the rehash, not the one that invoked it. Don't know how to fix that, beyond switching to a shell like 'zsh' that doesn't need manual rehashing.
Sysop: | Gate Keeper |
---|---|
Location: | Shelby, NC |
Users: | 790 |
Nodes: | 20 (0 / 20) |
Uptime: | 41:10:19 |
Calls: | 12,115 |
Calls today: | 5 |
Files: | 5,294 |
D/L today: |
72 files (9,959K bytes) |
Messages: | 564,934 |