The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
{} in shell programming
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
{} in shell programming
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
09-28-2006
Dhruva
Registered User
Join Date: Mar 2006
Location: India
Posts: 255
{} is used for building strings.
Code:
FILE = 'basename $1'
the above line of code is taking first parameter passed to this script as argument.what basename command will do here is if you have given the filename with path like /abc/dir1/dir2/filename then the
Value of FILE that is $FILE will have value "filename".
Code:
BANK = 'dirname $1'
the above command will remove the filename and assign path of file to BANK.
BANK will be "/abc/dir1/dir2/"
Code:
INFILE = ${FILE}.${BANK}.$$
Now the INFILE will have value "filename./abc/dir1/dir2/.3456"
here $$ gives the process id. in unix each command will run as a process and generates id.and value of $$ may differ in each run.
Dhruva
View Public Profile
Find all posts by Dhruva
Find Dhruva's past nominations received
Find Dhruva's present nominations given