Re: [Fish-users] fish and scp wildcards
Status: Beta
Brought to you by:
liljencrantz
|
From: Kristleifur D. <kri...@gm...> - 2011-07-06 21:55:26
|
On Wed, Jul 6, 2011 at 9:37 PM, SanskritFritz <san...@gm...>wrote: > On Wed, Jul 6, 2011 at 11:12 PM, Sebastian Thörn <ele...@p0...>wrote: > >> Hi guys and gals, >> >> i wonder if there is any chance to implement wildcards (*) into >> the functionality of fish when using scp? >> >> this works in bash: >> $ scp use...@ho...:~/Whatever/*.pdf . >> >> This command will transfer all files in ~/Whatever/ ending with .pdf to >> the working directory. >> If i run the same command in fish i get the following: >> ~> scp un...@ho...:~/Whatever/*.pdf . >> fish: Warning: No match for wildcard “un...@ho...:~/Whatever/*.pdf”. >> The command will not be executed. >> scp un...@ho...:~/Whatever/*.pdf . >> ^ >> >> I asked around in #fish and SanskritFritz and adisbladis explained to me >> it's because bash is checking my files on the remote site or something. (i >> didn't quit understand) >> >> My question is: >> Would this be possible to implement in fish? >> >> Br >> Sebastian Thör >> > > Here is the transcript of that conversation. > > 10:21 < SanskritFritz> because that needs bash to look into the server over > an ssh connection > Hi :) Bash doesn't actually need to look at the server. What is going on is that Bash can't match any local files against the wildcard, so it passes the wildcard to scp. Scp then opens the connection, and uses the wildcard to match against remote files. Fish can do exactly the same thing. The difference is that fish substitutes wildcards differently; If fish can't match wildcards to local files, then it doesn't run and warns you about it. (Which is a really cool thing to do IMO, it's great once you get used to it. Less dangerous, actually.) What you want is to escape the wildcard, e.g. tell Fish to not process it but rather pass it on to the process your're starting. This works here because scp accepts wildcards. I don't remember the syntax, but it's roughly like this: scp user@server:dir/file\* localdir or scp user@server:"dir/file\*" localdir or scp "user@server:dir/file\*" localdir Hope I'm not wrong here :) -- Kristleifur |