0

I need to export a variable to point to the current working directory of the script.I know that i can use pwd to print the current working directory.But how can i export it ?

export DYLD_FALLBACK_LIBRARY_PATH="the script working path"
pnuts
  • 58,317
  • 11
  • 87
  • 139
techno
  • 6,100
  • 16
  • 86
  • 192
  • Do you mean [How to set a BASH variable equal to the output from a command?](http://stackoverflow.com/q/4651437/258523)? – Etan Reisner Oct 15 '15 at 18:51
  • @EtanReisner Yeah.How can use it here for pwd command? – techno Oct 15 '15 at 18:53
  • The same way you use it for any other command. Did you read the linked question and the accepted answer? Did you try it? – Etan Reisner Oct 15 '15 at 18:53
  • @EtanReisner So i use VAR="$(pwd)" – techno Oct 15 '15 at 19:00
  • @EtanReisner Got it.But the double quotes does not come ..VAR=pwd echo "export DYLD_FALLBACK_LIBRARY_PATH=$VAR:/usr/lib" – techno Oct 15 '15 at 19:13
  • You don't want the quotes in the variable value. They will only hurt you. The quotes are for the shell that sees the value. They aren't wanted in the value itself. You quote the *expansion* of the variable if you need the expansion to stay as one word. `="$VAR:/usr/lib"`, etc. – Etan Reisner Oct 15 '15 at 19:22
  • @EtanReisner okay.thanks – techno Oct 15 '15 at 19:24

0 Answers0