From owner-freebsd-questions@FreeBSD.ORG Thu Apr 12 17:20:14 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9066116A401 for ; Thu, 12 Apr 2007 17:20:14 +0000 (UTC) (envelope-from freebsd-questions@voidcaptain.com) Received: from mx4.x15.net (mx4.x15.net [69.55.237.194]) by mx1.freebsd.org (Postfix) with ESMTP id 7A97913C4BD for ; Thu, 12 Apr 2007 17:20:14 +0000 (UTC) (envelope-from freebsd-questions@voidcaptain.com) Received: from j1.x15.net [63.196.213.76] by mx4.x15.net with ESMTP id 611291731X1Hc2ix00031k5o; Thu, 12 Apr 2007 17:04:43 +0000 Message-ID: <461E668B.4090401@voidcaptain.com> Date: Thu, 12 Apr 2007 10:04:11 -0700 From: Pete Slagle MIME-Version: 1.0 To: Aitor San Juan References: <33E0F3313625E543ACCC41AE2DFD5EF5024280@BB06.bolsabilbao.local> In-Reply-To: <33E0F3313625E543ACCC41AE2DFD5EF5024280@BB06.bolsabilbao.local> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Shell scripting: Absolute path name of a file given as parameter X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2007 17:20:14 -0000 Aitor San Juan wrote: > I have developed a shell script that, among other things, shows the filename > that was specified as a parameter. > > However, when I invoke the script and the file is located in the current working > directory, it just shows: ./my_input_filename > > 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)