I started with PWK and I am stuck at a bash script session.The following code works for me:
#!/bin/bash
for var in $(cat wordlist.txt); do
host $url.megacorpone.com &
done
What this does as told in the lecture is the use of "&" symbol, i.e. the background scanning while one instance has been created and it works correctly.
But, when I try the command line:
for url in $(cat wordlist.txt); do host $var.megacorpone.com &;done;
it gives me a junk output, then shows : 0xarjun@localhost:
and when I press enter, shows the result of previous command. What in the world is happening?
From bash man page:
A list is a sequence of one or more pipelines separated by one of the operators
;
,&
,&&
, or||
, and optionally terminated by one of;
,&
, or<newline>
.
Remove the sequential operator ;
right after the background operator &
, as both are not allowed together in bash.