For Programmers: Free Programming Magazines  


Home > Archive > AWK > June 2007 > Re: absolute path of the running script [OT]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: absolute path of the running script [OT]
Manuel Collado

2007-06-20, 9:57 pm

Daniel C. Bastos escribió:
> In article <f58jqg$rl2$1@news.xmission.com>,
> Kenny McCormack wrote:
> ...
> These are my systems; if I could get a solution to work on any of them,
> it would be great. Once I learn one solution, and if happens to specific
> to one of them, then I will try to mimic that somehow on the rest of the
> systems that I'd like to have it running. Whatever suggestion you have,
> it is most appreciated. I'm pairing AWK with the OS it is running on.
> ...
> %uname -a
> MINGW32_NT-5.1 SATURN 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown


If you are on WINDOWS NT/2000/XP, the native cmd.exe shell can help:

------ awkpath.bat ------------------------
@echo off
rem Lookup an AWK script

rem Look into the curent directory
if exist %1 (
echo Found: %1
exit /B
)
rem Look into AWKPATH
if .%AWKPATH%.==.. goto notfound
if .%~$AWKPATH:1.==.. goto notfound
echo Found: %~$AWKPATH:1
exit /B

:notfound
echo Not found: %1
echo AWKPATH=%AWKPATH%
-------------------------------

The script is OS specific. You can invoke it as:

...> awkpath somefile.awk


Regards.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com