I am trying to pass a variable as a part of a bash command in my Rust program.
let speed_output = 70;
Command::new("nvidia-settings")
.arg("-a")
.arg("GPUTargetFanSpeed[fan:0]=speed_output")
.spawn()
.expect("nvidia-settings command failed to execute");
The program compiles correctly but my variable speed_output
isn't passed to the bash shell. I would like to know how to pass variables from the Rust environment directly into the argument.