Question: I'm trying to write a bash script where part of a directory is a long, unknown string. I know the first part of the directory name. How do I combine the known string and the wildcard in the path? As of now, I have:

```
ID=$1;

IMP="adam@ocelot.cs.edu:/data/"$ID"/EER_DATA/$ID"*"/ImpostorScores.txt"

```

but this passes a literal `*`.

Answer: 
There are several options,

1. Use NFS or FUSE-over-SSH or something to expose the remote filesystem locally, then let `bash` apply the default `FOO=/*/passwd` glob on that exported filesystem path. (ZSH has a `${~spec}` glob substitution parameter expansion, otherwise see your shell's manual.)
2. SSH over to the remote system, and do the glob there. `ssh host 'echo /*/passwd'`
3. Pass the escaped (or otherwise defanged via backslash or single quotes) glob through to the remote system, `scp host:/\*/passwd .`

Some of these options are prone to race conditions should the filename change between when the glob is done and any subsequent steps involving that (possibly changed) filename.
You can use tar over ssh,

`tar cf - filename | ssh adam@ocelot.cs.edu "cd /data/$ID/EER_DATA/$ID*; tar xf -"`

Make sure you have setup ssh-agent so it won't prompt you with the password. I don't think you can use wildcard dir with scp, not even working with a regular cp.

I've tested this on bash and zsh.