Hello
I am using this command:
Code:
awk '($9 ~ /307/)' /home/nginx/domains/mydomain.com/log/access.log | awk '{print $7}' | sort | uniq -c | sort -rn
and i am getting an output like this:
Code:
7 /login/
3 /login
1 /login/?ref=a
Now i was trying to create a bash script for it like this:
Code:
#!/bin/bash
echo Please select the error code:
read errorcode
awk '($9 ~ /${errorcode}/)' /home/nginx/domains/mydomain.com/log/access.log | awk '{print $7}' | sort | uniq -c | sort -rn
as an error i am typing 307 but it doesn't work as i get a blank result
When i use echo and the variable it works...
I was trying to set also the variable in quotes but it was not working ....
Anyone knows how to do that?
Thank you