Pantheon Community

Discussion for doc: Terminus Command Reference

Terminus Command Reference
How can i show / get selected sites only. like my sites name are myorg-uk and myorg-us etc there are arround 20+ sites but i want to select only myorg-uk and myowg-us then how can i pass to --name paramter. is any way other then regix expression bcz my sites name are unique there no regix possible

terminus site:list --name

1 Like

If you only want to send commands to myorg-uk and myorg-us, I’d just hard code them, honestly. Alternatively, set up a script with a command line argument that will determine the site to which commands are sent. Then, you can run the command twice and it’ll work for other sites in the future.

Are you writing a bash script? If so, this could be helpful: https://linuxcommand.org/lc3_wss0120.php. Just scroll down to the Command Line Options header. That’s how I tend to do them.

2 Likes

What is it you’re ultimately trying to achieve? We’re trying to debug a step in the process, but it may be that there’s a better process to reach the goal.

For example, if you had a set list of specific sites you wanted to run a set of commands on, you could put them in a text file and iterate through it in bash, as discussed here.

1 Like

We use bash scripts with terminus to do all sorts of things, but the way we select what sites to do things on is by using Pantheon tags. Then, we do the following in the script:

SITENAMES=`terminus org:site:list --field=id --format=list --tag=$1 $ORG`

And pass the tag as an argument to the bash script. Then, we do a for loop over the SITENAMES and run terminus commands. I’m happy to provide a more detailed example if you need.