How to force parameter expansion of $ variable within result of `grep` to pass to another command

Miss Swiss

I have a shell script that passes the content of a .env file with grep

export $(grep -v '^#' .env | xargs)

In .env there's:

PYTHONPATH=$PYTHONPATH:$PWD

however, if I run the command, the $ variable expansion does not take place.

$ echo $PYTHONPATH
$PYTHONPATH:$PWD

How do I force $ variable expansion before it's exported?

l0b0

An easier way to get such a file into the current context is to source it: . ./.env. For the vast majority of cases this is equivalent to copy/pasting the code into your script and running it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Bash variable expansion in command

From Dev

How to pass a shell script argument as a variable to be used when executing grep command

From Dev

How to retain grep color when storing in variable or piping to another command?

From Dev

Bash script - variable expansion within backtick/grep regex string

From Dev

How to pass parameter by variable in JAVASCRIPT

From Dev

How can I pass optional parameters to another command within a bash script?

From Dev

Shell script -- how to store curl command WITH variables result into another variable?

From Dev

How to force parameter expansion of $ variable within result of `grep` to pass to another command

From Dev

How to pass '*' wildcard to path parameter of find command via a variable in script?

From Dev

How to pass argument to ENTRYPOINT with variable expansion?

From Dev

How to pass '*' wildcard to path parameter of find command via a variable in script?

From Dev

How to save the result of grep to variable x?

From Dev

How can I send the dropdown value on selection to pass as a parameter to another function within the same controller; angular

From Dev

Put command result in variable within makefile target

From Dev

Use parameter expansion to modify output of another expansion

From Dev

Parameter expansion in grep

From Dev

How to pass parameter by variable in JAVASCRIPT

From Dev

How to pass curl result as parameter

From Dev

pass the result of command to another in batches

From Dev

How to pass result of command within While Loop in PowerShell?

From Dev

Pass a variable in another variable within an awk

From Dev

Pass array variable as parameter to another function

From Dev

How can I pipe the result of the wc command into an arithmetic expansion?

From Dev

How to pass the variable of the result of find command to dd

From Dev

How to get the result of a grep command on a variable into another variable

From Dev

How do I pass the result from a command to another command's option in a single npm run script?

From Dev

Parameter expansion (variable expansion) and quotes within quotes

From Dev

How to pass parameter to netsh command

From Dev

Using find with grep and pass the result to another grep

Related Related

  1. 1

    Bash variable expansion in command

  2. 2

    How to pass a shell script argument as a variable to be used when executing grep command

  3. 3

    How to retain grep color when storing in variable or piping to another command?

  4. 4

    Bash script - variable expansion within backtick/grep regex string

  5. 5

    How to pass parameter by variable in JAVASCRIPT

  6. 6

    How can I pass optional parameters to another command within a bash script?

  7. 7

    Shell script -- how to store curl command WITH variables result into another variable?

  8. 8

    How to force parameter expansion of $ variable within result of `grep` to pass to another command

  9. 9

    How to pass '*' wildcard to path parameter of find command via a variable in script?

  10. 10

    How to pass argument to ENTRYPOINT with variable expansion?

  11. 11

    How to pass '*' wildcard to path parameter of find command via a variable in script?

  12. 12

    How to save the result of grep to variable x?

  13. 13

    How can I send the dropdown value on selection to pass as a parameter to another function within the same controller; angular

  14. 14

    Put command result in variable within makefile target

  15. 15

    Use parameter expansion to modify output of another expansion

  16. 16

    Parameter expansion in grep

  17. 17

    How to pass parameter by variable in JAVASCRIPT

  18. 18

    How to pass curl result as parameter

  19. 19

    pass the result of command to another in batches

  20. 20

    How to pass result of command within While Loop in PowerShell?

  21. 21

    Pass a variable in another variable within an awk

  22. 22

    Pass array variable as parameter to another function

  23. 23

    How can I pipe the result of the wc command into an arithmetic expansion?

  24. 24

    How to pass the variable of the result of find command to dd

  25. 25

    How to get the result of a grep command on a variable into another variable

  26. 26

    How do I pass the result from a command to another command's option in a single npm run script?

  27. 27

    Parameter expansion (variable expansion) and quotes within quotes

  28. 28

    How to pass parameter to netsh command

  29. 29

    Using find with grep and pass the result to another grep

HotTag

Archive