Linked Questions

4 votes
2 answers
3k views

Bash variable assignment before command [duplicate]

A couple of days ago I came across a command AWS_ACCESS_KEY="foo" AWS_SECRET_KEY="bar" aws list iam I see that setting variables before a command adds those variables in the command's environment: #...
kmad1729's user avatar
  • 1,554
598 votes
7 answers
487k views

How to keep environment variables when using sudo [closed]

When I use any command with sudo the environment variables are not there. For example after setting HTTP_PROXY the command wget works fine without sudo. However if I type sudo wget it says it can't ...
Ahmed Aswani's user avatar
  • 8,519
194 votes
4 answers
170k views

How can I set an environment variable only for the duration of the script?

On Linux (Ubuntu 11.04 (Natty Narwhal)) in Bash, is it possible to temporarily set an environment variable that will only be different from the normal variable for the duration of the script? For ...
suchipi's user avatar
  • 1,941
141 votes
3 answers
95k views

Why should eval be avoided in Bash, and what should I use instead?

Time and time again, I see Bash answers on Stack Overflow using eval and the answers get bashed, pun intended, for the use of such an "evil" construct. Why is eval so evil? If eval can't be used ...
Zenexer's user avatar
  • 19.4k
62 votes
5 answers
47k views

Setting environment variable for one program call in bash using env

I am trying to invoke a shell command with a modified environment via the command env. According to the manual env HELLO='Hello World' echo $HELLO should echo Hello World, but it doesn't. If I do ...
Niklas's user avatar
  • 1,350
22 votes
4 answers
18k views

passing command line argument to python-behave

I am using python-behave for BDD testing, I have to pass an URL (e.g. www.abc.com) from command line. $behave -u "www.abc.com" To achieve this, I have read behave documentation but there are not ...
user3375505's user avatar
10 votes
1 answer
9k views

Git index and commit is very slow

I have a local git repository and use git add file1 file2 file3... to add my modifications to the git index. Afterwards I use a plain git commit. Each command takes around 3 to 6 seconds. My ...
Daniel Stephens's user avatar
7 votes
2 answers
4k views

Pass environment variable to multiple commands

When I do Hello=123 npm run a && npm run b && npm run c I was expecting Hello=123 environment variable to be passed inside a, b and c process. But it turns out only a has the ...
Shih-Min Lee's user avatar
  • 9,570
55 votes
0 answers
65k views

How to add a line in sed if not match is found [duplicate]

I am using the following sed command to replace some parameters in a config file: sed -i 's/^option.*/option=value/g' /etc/fdm_monitor.conf Now I have one problem. If the line does not exist, I want ...
Evilmachine's user avatar
6 votes
1 answer
5k views

Limit GPU devices in Tensorflow

I am developing in Python an application which uses Tensorflow and another model which with GPUs. I have a PC with many GPUs (3xNVIDIA GTX1080), due to the fact that all models try to use all ...
caleale90's user avatar
  • 170
6 votes
3 answers
7k views

How to start node server and export NODE_PATH (with npm start or inline command)

Before starting the server, I need to export ('set' actualy, I'm using Win7) NODE_PATH variable. I tried to do it with this command (not working even in command line): set NODE_PATH=./ && ...
Maksim Nesterenko's user avatar
4 votes
1 answer
2k views

colour scheme for gnu source-highlight with a dark background

I'm using gnu source-highlight mostly with less (so it's using ANSII terminal codes to make colours). However, with a dark background colour, the highlighted parts are dim and hard to read. Is there ...
drevicko's user avatar
  • 15k
4 votes
1 answer
2k views

Cannot set environment variable before command

I am trying to set a variable before calling a command in bash (on Mac): BRANCH=test echo "$BRANCH" But I get an empty echo. printenv also has no other variable with the same name: $ printenv | ...
Gabriel Petrovay's user avatar
0 votes
1 answer
4k views

How can I specify environment variables for the VS Code process in my VS Code settings?

I find those two method to add environment variables. add environment variables in terminal.integrated.env.osx for terminal。 add environment variables in launch.json for debugging. But no similar ...
tabris's user avatar
  • 1
1 vote
1 answer
898 views

Start Xdebug session for Symfony CLI commands

My dev setup includes PHP 8 and Xdebug 3 in a docker container for a Symfony project. Currently I use xdebug.start_with_request=yes, but I don't like the performance impact that has. How do I start an ...
simon.ro's user avatar
  • 3,189

15 30 50 per page