Skip to content
Ivan Krutov edited this page Mar 29, 2016 · 2 revisions

While working in a cloud a frequent task is to do bulk operations. For example you may wish to reboot several instances or delete some images. To do this in Perspective Shell you should use expressions with the simple syntax described below. We'll use reboot command as an example to describe available options.

Apply command to entities (instances, images and so on) matching regular expression

This is the default behavior and anything you type is considered as a Perl-compatible regular expression.

perspective> reboot test-.*

The command above will reboot all instances starting with test- (like test-vm or some-test-1) because .* means any number of symbols. One command can match against multiple patterns - just separate them with commas:

perspective> reboot test-.*,example-.*

Apply command to entities exactly matching some string

To process only entities exactly matching some string you should enclose this string in ^$, e.g. ^string$.

perspective> reboot ^test-vm$,^one-more-vm$

This command will only reboot test-vm and one-more-vm instances.

Apply command to entities containing some string

Although this can be achieved using regular expressions Perspective shell supports %-syntax like the following:

perspective> reboot %vm%

This command will process every instance containing vm somewhere inside its name.