Date: Fri, 13 Apr 2007 08:33:39 +0200 From: "Aitor San Juan" <asanjuan@bolsabilbao.es> To: <freebsd-questions@freebsd.org> Subject: RE: Shell scripting: Absolute path name of a file given as parameter Message-ID: <33E0F3313625E543ACCC41AE2DFD5EF5024308@BB06.bolsabilbao.local> In-Reply-To: <461E668B.4090401@voidcaptain.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks a lot to all who replied. Aitor. -----Mensaje original----- De: Pete Slagle [mailto:freebsd-questions@voidcaptain.com] Enviado el: jueves, 12 de abril de 2007 19:04 Para: freebsd-questions@freebsd.org Asunto: Re: Shell scripting: Absolute path name of a file given as parameter Aitor San Juan wrote: > I have developed a shell script that, among other things, shows the = filename > that was specified as a parameter. >=20 > However, when I invoke the script and the file is located in the = current working > directory, it just shows: ./my_input_filename >=20 > I'd like the script to show the full path name of the input file. I = wonder > whether there is or not an equivalent to %~f1 (Windows Batch file = programming). > This parameter extension expands parameter %1 ($1 in shell scripting = jargon) to a > Fully qualified path name. man (1) realpath For example: #!/bin/sh echo The full path of the file name is $(realpath $1) ************ LEGEZKO OHARRA / AVISO LEGAL / LEGAL ADVICE *************=20 Mezu honek isilpeko informazioa gorde dezake, edo jabea duena, edota = legez babestuta dagoena. Zuri zuzendua ez bada, bidali duenari esan eta = ezabatu, inori berbidali edo gorde gabe, legeak debekatzen duelako = mezuak erabiltzea baimenik gabe.=20 -------------------------------------------------------------------------= - Este mensaje puede contener informaci=F3n confidencial, en propiedad o = legalmente protegida. Si usted no es el destinatario, le rogamos lo = comunique al remitente y proceda a borrarlo, sin reenviarlo ni = conservarlo, ya que su uso no autorizado est=E1 prohibido legalmente. -------------------------------------------------------------------------= - This message may contain confidential, proprietary or legally privileged = information. If you are not the intended recipient of this message, = please notify it to the sender and delete without resending or backing = it, as it is legally prohibited. *************************************************************************= *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33E0F3313625E543ACCC41AE2DFD5EF5024308>