I'd like to assign a shell command (sh or csh) output to an OCEAN variable but the problem is that Shell always return "t" and nothing else.
I would need to be able to get the results of a "pwd | cut -d "/" -f 8" command (that returns the name of my testbench which is the same as my testbench-cellview) where my script is loaded from, and put the results of this command in an OCEAN variable so that I can paste the name to the right directory to open all my result in batch.
My script would look like this :
corner_list='("corner_1" "corner_2" "corner_3")
simDir = "/home/my_name/path/to/all/testbench/"
testbench = sh("pwd | cut -d "/" -f 8")
openResults( strcat( simDir "/" testbench "/" corner ) )
selectResults( 'tran )
This script would be automatically load all my corner PSF results in Cadence Results Browser for "familly plot" without editing the script to change the testbench name inside before running it.
ipcId=ipcBeginProcess("pwd | cut -d '/' -f 8")ipcWait(ipcId)testbench=ipcReadProcess(ipcId)
Simpler is to do this though:
nthelem(7 parseString(getWorkingDir() "/"))
This avoids launching any child process.
In reply to Andrew Beckett:
Thanks a lot !! I almost get it working. I used the nthelem command
When I execute my script interactively in a shell running Ocean, it works fine.
But when I try to execute the script from ICFB it tells me :
*Error* strcat: argument #2 should be either a string or a symbol (type template = "S") - nil*Error* load: error while loading file - "/home/my_name/path/to/all/testbench/my_testbench/plot.ocn" at line 8
My script is as following :
testbench = nthelem(7 parseString( getWorkingDir() "/" ) )
Line 8 : simDir = strcat("/home/my_name/path/to/all/testbench/" testbench "/my/results")
I don't understand why it works interactively (awd.exe version 5.1.0) but not when I load the script (icw 6.1.5)
In reply to The Setlaz:
If the directory doesn't have enough delimiters (i.e. "/") then the nthlem will return nil. What does getWorkingDir() return in each case - the working and nonworking cases?
Indeed, in the non-working case,nthelem returns "nil"
Interactively (i.e the working case), it returns the full path as expected.
Any clue about what can cause different behavior ?
I asked what getWorkingDir returns, not what nthelem returns. It was obvious from the error that nthelem must have returned nil.
Can you show that in each case?
Oops, my mistake !
getWorkingDir() does not return the expected path (unsurprisingly...). It returns the path from which I launched ICW (/home/my_name) whereas I expected to get the path where the script is loaded from.(/home/my_name/path/to/all/testbench/my_testbench/)
Thanks a lot,