I'm trying to write a bash script that runs a remote script via ssh as below:#!/bin/bashlogfilepattern=*drupal*.gz php*.gz error*.gzfunction getlogcounts {    echo in getlogcounts    echo  $1    echo  $2    ssh $1 bash -c '  \  #script string starts here    cd $2    for file in `ls $logfilepattern`    do     ls -l $file    done'}getlogcounts me@remoteserver.com /var/log/mylogs$1 and $2 seem to come across ok into the function, but inside the script string they don't appear to have a value... hence cd $2 evaluates to cd and ls $logfilepattern evaluates to ls.
Passing script string to ssh from within a bash script function - variable evaluation problem
bash;shell;ssh;quoting