2

How to mention the cursor in the commands

 2 years ago
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

advertisements

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?

Update I edited the code below to match the suggestions and it works correctly now. I've seen several stack overflow questions similar to this one, but I haven't quite been able to put it all together. I have the following xaml code. <UserControl x:C

How to pass the command object to the method?

I have a Command table which look like this in rails console Command(id: integer, created_at: datetime, updated_at: datetime, timeout: integer, name: string, command: text, action: string, reboot_action: string, num_retries: integer, partnum: string,

How to clear the command prompt in windows

Please can any one help me out how to clear the command prompt in windows while using mysql in command prompt how can i clear the screen Please can any one help me out how to clear the command prompt in windows while using mysql in command prompt how

How to change the command line prompt in Windows?

How to change the command-line prompt into a console? I've been looking for in the console functions API but I could not find anything for it. http://msdn.microsoft.com/en-us/library/windows/desktop/ms682073%28v=vs.85%29.aspxThere's the PROMPT enviro

How to pass the command line argument to gnuplot?

I want to use gnuplot to draw figure from data file, say foo.data. Currently, I hardcoded the data file name in the command file, say foo.plt, and run command gnuplot foo.plg to plot data. However, I want to pass the data file name as a command argum

How to get the command status executed by system ()

see i am using one system call in my c code #include <sys/stat.h> #include <stdio.h> int main(int argc, char *argv[]) { int a = system("./test12.out"); //here if i am giving any wrong commad system("echo $?") printf("s

How to make the command connection in Silverlight MVVM?

I trying to use MVVM in some silverlight modal that i wrote - I wrote the view - and the viewmodel part - but i need to make the command between them and i don't know how to do it. In the view i have single button that will launch the command. How to

How to run the command prompt from php

As am very new to php. I have the following command as: cd E:\PHP\home_php\img\tmp E: montage -mode concatenate -tile 3x3 *.png result.png I want to execute the command from cmd.exe in php(if possible from javascript too). Right now I have to execute

TCP port using python - how to transfer the command output to the tcp port?

I want to develop a code in python which will open a port in the localhost and will send the logs to that port. Logs will be nothing but the command output of a python file. like : hello.py i = 0 while True: print "hello printed %s times." % i i

How to use the command to delete folders on FTP?

Suppose there are some folders on FTP site: test_20160125,test_20160222 I use the command to delete the specific folders on FTP: ftp> rm *test_* 550 The filename, directory name, or volume label syntax is incorrect. How can I delete the folders using

How to capture the command line output of an application

When I ran the command ffmpeg -i rtsp://172.19.1.40/live.sdp -acodec copy -vcodec copy lala.avi The ffmpeg will be continuously printing(refresh) the information fps and bitrate everyone second. How could I save those information using Python? You ca

How to open the command prompt from powershell

I am new to powershell. Can any body please explain me how to open command prompt from powershell. I want to open command prompt and run Dir command Is it possible to use new-object -comobject for this???dir is built into PowerShell. It's an alias fo

How to check the command line if a given file or directory is locked (used by any process)?

I need to know that before any attempt to do anything with such file.Not sure about locked directories (does Windows have that?) But detecting if a file is being written to by another process is not difficult. @echo off 2>nul ( >>test.txt echo of

How to support the command in REST while performing REST, CQRS and EventSourcing together?

Consider the following coarse grained REST apis for a Contact resource POST /api/contacts GET /api/contacts GET /api/contacts/:id PUT /api/contacts/:id DELETE /api/contacts/:id Consider using eventsourcing for the contact resource, i.e. commands are

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK