fork download
  1. #!/bin/bash
  2. test="foo@bar:/here/path/"
  3. regex='^([[:alnum:]_.-]+)@([[:alnum:]_.:-]+):[~./]'
  4. if [[ "$test" =~ $regex ]]; then
  5. echo "yes, remote host"
  6. else
  7. echo "no, local"
  8. fi
Success #stdin #stdout 0s 4440KB
stdin
Standard input is empty
stdout
yes, remote host