OsakaWebbie
OsakaWebbie

Reputation: 699

bash script: how to cd when uncertain of whole directory name?

I'm trying to write a bash script to install the latest texlive on a server (part of provisioning in Vagrant). Texlive comes packaged as install-tl-unx.tar.gz, but when unpacked, the resulting directory name includes the date of the last upgrade, e.g. install-tl-20161129. Since I can't predict the date portion of the directory name, how can I cd into it? Is there a script equivalent of hitting tab? I searched but couldn't find anything applicable.

Upvotes: 0

Views: 65

Answers (1)

Cyrus
Cyrus

Reputation: 88573

I suggest to use globbing:

cd install-tl-*

or to catch 8 digits with globbing:

cd install-tl-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]

Upvotes: 4

Related Questions