Run Script string parsing
  #1 (permalink)  
Unread 09-03-2009, 12:48 PM
v850 v850 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 2
Default Run Script string parsing

Does anyone know how to parse a string in a script inside a Run Script target?

In particular, there is an Input Files list below the script. What I want is just the file name from the list. It appears that if you place just a name in the list it is accessed with $(SRCROOT) prepended. ie: ~/usr/projects/project/filename.cpp

I access the list in the script with
Code:
inputFile=`eval echo '$SCRIPT_INPUT_FILE_'$i'
which is what gives me the string above.

What I want is just the 'filename'.

I've read various docs and have not find the magic combination. it would be nice if someone could point me to some example code or docs that describe string parsing with shell scripting.
Reply With Quote

  #2 (permalink)  
Unread 09-24-2009, 12:55 PM
v850 v850 is offline
Junior Member
 
Join Date: Sep 2009
Posts: 2
Default

Solved.

Within the scripting you cannot assign the output from "basename" directly to a variable. Instead I filtered out the name from the path given:
Code:
#  get just the name with extension from path
  fileName="${inputFile##*/}"

# now get just the name
  fileName="${fileName%.*}"
Reply With Quote
Reply

Tags
parsing, run script, shell script, string, string parsing

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 11:03 PM.


vBulletin skin developed by: eXtremepixels
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28