Skip to content
Advertisement

Tag: shell

What is text syntax in ImageMagick

I use following code convert text to image what is x, y means in text x, y ‘string’? Answer Method 1 label: You can either use label: which provides a canvas large enough to hold your text – notice I didn’t provide a canvas size: Method 2 -annotate Or, you can use -annotate to write onto an outsize canvas, then

Using grep and * to get the exact file name

I have following heapdump files now if I use I get following output But I use I get no output. Could anybody help where is my mistake and how to search the heapdump files. My expected output is should give me due to some reason I could not use Answer It looks like you’re confusing glob patterns with regular expressions,

Converting watch into a unit file systemd

I’ve got a shell script as follows ss.sh The requirement is that I need to use this script with the watch command. And I’d like to make this into a systemctl service. I did it as so. sc.sh And in my /etc/systemd/system, log_info.service When I run systemctl start log_info.service, It runs but not continuously the way I’d like it to.

Bash if condition doesn’t match when comparing particular string

Bash if condition doesn’t match when comparing particular string Matching string: Code: I expected this to match, but it does not. The same code works with other strings. Is this failing because of ( or ) character in the string? Answer You have variable matching reversed. You have to use * matching around subset variable not the superset variable. Use:

grep multipe wildcards in string

Say I have a file that contains: I want to grep and match lines that only contain ‘package’, ‘el6’, and ‘x86_64’ How would I go about doing that on a one liner using grep? The line must match all three and grep shouldn’t care about how many characters are in between. If there is a better tool for the job,

Powershell for Linux: Workaround for missing “out-gridview”?

In Aug 2016, Microsoft’s Powershell went open-source. However, there is no “out-gridview” option yet. The autocompletion feature shows these Out* options Note that there is no Out-Gridview at this time. Did I overlook a feature, commandlet that can do something similar? Sometimes I’d ike to have my tabular data displayed in a sortable GUI Window (for showing something to windows

how to calculate percentage in shell

I would like to calculate percentage in shell. But I can’t do it. My script is It is neither showing any value nor terminating when executing this script. Answer awk will give you an n1 illegal field name if you do that, as it’s inside single quotes. Also, to avoid awk keep reading stdin you should pass /dev/null as file.

Execute root command with no root user avoiding password prompt

I have a script.sh file executing the following command: If i try to execute with a non-root user (username = marco), the prompt password halts the script waiting for the input. I’m trying to configure the /etc/sudoers file adding the following lines, but with none of them works and I’m always prompted for sudo password: Any clue? Thank you. Answer

Automation of networks using ansible on openstack

I’ve written an ansible script, to create a network based on a condition. So that, even if I run ansible script again it will not create duplicate entries in my openstack environment. task: I don’t have either of the twonetworks in my project. My intention was, both the statments display null output and firsttime condition becomes true and it should

Advertisement