=== compdoc_ is now known as compdoc === miguel is now known as Guest44856 [00:47] why does sudo -u someuser bash -c "for i in {1..5}; do echo $i; done" not work the way expected? [00:57] skylite: because you didn't escape the $ [00:58] skylite: so $i was expanded when the command line was processed, and since $i was empty then, you ended up with "for i in {1..5}; do echo ''; done" [00:58] but it prints 5 five times [00:59] because of your for loop, yes [00:59] it set $i to 1, then ran an empty echo line, then set $i to 2, etc etc [01:01] I dont really see how escaping solves this issue [01:02] it prevents $i from being expanded when processing the inital command line [01:02] I tought escaping makes the shell interpret $ as a character and not as a variable sign [01:02] yes [01:02] the shell you're typing your command line into no longer interprets that as a variable to expand [01:03] so, it passes the string $i as a command line parameter [01:03] I see [01:03] and THAT shell that you're running sees "$i", and goes "oh, a variable!" [01:03] remember, there's two shells here [01:03] the "bash -c" in your command line, and the shell you're running that command line in [01:06] jerichowasahoax: thx [01:15] skylite: np [05:38] hello