The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Simulators >> Circuit Simulators >> ocean script how to print an aliased path https://designers-guide.org/forum/YaBB.pl?num=1307448325 Message started by Zorro on Jun 7th, 2011, 5:05am |
Title: ocean script how to print an aliased path Post by Zorro on Jun 7th, 2011, 5:05am hello all, I do have a question regarding ocean scripts. it is probably very basic but I'm new to linux and the shell. hope someonce can help me. if I type: cd /design/libs/at77000/dev/ the command takes me to this directory (by typing pwd): /design/libs/at77000/v0.9 i.e. "dev" is defined to take me to the newest version (some kind of an alias?), in this case to the directory v0.9 in fact if I go one directory up to /design/libs/at77000 and I do "ll" I can see: dev -> v0.9/ I am using ocean scripts and for documentation it is important for me to print/show which version is been used in the simulation so I am doing something like this. first I define: model_path="/design/libs/at77000/dev/" and then: fprintf(out "\n\n Version Used: %s \t" model_path) it's working, but the output file shows: Version Used: /design/libs/at77000/dev/ so my question is how to show the current version directory "v0.9" instead of "dev", i.e. I need to print this: Version Used: /design/libs/at77000/v0.9/ the version is changing from time to time and that's why the path is defined as "/design/libs/at77000/dev/" thank you very much and if you need more info please let me know. regards! |
Title: Re: ocean script how to print an aliased path Post by boe on Jun 8th, 2011, 5:31am Zorro, Zorro wrote on Jun 7th, 2011, 5:05am:
Try Code:
B O E |
Title: Re: ocean script how to print an aliased path Post by Zorro on Jun 9th, 2011, 4:49am thank you for your suggestion boe! I found a solution. the command "readlink" was the key! I added these lines: [color=#9900cc][color=#0000ff]file_out=sch_name.out ; output file name out=outfile(file_out "a") ; define and open the output file for writing fprintf( out "Model Version used for this simulation" ) setShellEnvVar("var_out=") ; reset environment variable $var_out setShellEnvVar(strcat("var_out=" file_out )) ; set environment variable $var_out to out_dir csh(" readlink -f /design/libs/at77000/dev >> $var_out ") ; write model version into output file[/color][/color] now the output file has the new 2 lines included: [color=#0000ff] /design/libs/at77000/v0.9 Model Version used for this simulation[/color] Thanks for your attention and suggestions! Regards! |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |