Serious question, what exactly does do do? In my terminal I can see that do is a command but all I get is bash: syntax error near unexpected token do’and obviously with such a common name it's hard to find information on google about whatdo` actually does.
But then why is it available in my command line terminal as a command that I can use? Like when I type do and then hit TAB twice to list commands that match the output is dodone dofsck etc... but when I just enter do in the command line or do --help I get bash: syntax error near unexpected token 'do'
I would assume that since I can run sudo apt update that I could also run do apt update where it would run it not as a super user. I know just apt update would do that too, but I’m just so curious if it’s possible to use do as a user-level sudo or what else it might be able to do.
Serious question, what exactly does
do
do? In my terminal I can see that do is a command but all I get isbash: syntax error near unexpected token
do’and obviously with such a common name it's hard to find information on google about what
do` actually does.It’s used in loops in bash, like:
for i in 1 2 3 do echo "$i" done
or
while true do echo "o/" done
But then why is it available in my command line terminal as a command that I can use? Like when I type
do
and then hitTAB
twice to list commands that match the output isdo done dofsck etc...
but when I just enterdo
in the command line ordo --help
I getbash: syntax error near unexpected token 'do'
I would assume that since I can run
sudo apt update
that I could also rundo apt update
where it would run it not as a super user. I know justapt update
would do that too, but I’m just so curious if it’s possible to usedo
as a user-levelsudo
or what else it might be able to do.