How to mention the cursor in the commands
source link: https://www.codesd.com/item/how-to-mention-the-cursor-in-the-commands.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to mention the cursor in the commands
I am executing shell commands via Ansible.
Sometimes i don't have the complete foldername. Suppose i have dirname solr4.7.0
.
In shell I can type cd solr*
.
But in ansible I can't do:
chdir=/var/solr*
Is there any workaround?
No. The chdir=
parameter to, e.g., the command
module does not support wildcards.
You could accomplish what you want using a register variable to store the output of the ls
command:
- shell: ls -d solr*
register: dir_name
- command: chdir=dir_name.stdout some_command
But this is, frankly, an ugly solution. You're better off just using the actual directory name. If it differs on different hosts, you can use host variables to set it appropriately.
Related Articles
How to link the command to the check box in ListView WPF?
How to pass the command object to the method?
How to clear the command prompt in windows
How to change the command line prompt in Windows?
How to pass the command line argument to gnuplot?
How to get the command status executed by system ()
How to make the command connection in Silverlight MVVM?
How to run the command prompt from php
TCP port using python - how to transfer the command output to the tcp port?
How to use the command to delete folders on FTP?
How to capture the command line output of an application
How to open the command prompt from powershell
How to check the command line if a given file or directory is locked (used by any process)?
How to support the command in REST while performing REST, CQRS and EventSourcing together?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK