Skip to content

Tag: bash

running python3 app at start up of Linux

I have the following script But the output is : the app has no problem running when I manually run it by typing python3 Server.py UPDATE: Clarification to the post I need the app to start running after the user pi logged in because it will need to get access to chrome Answer So after the previous comment was …

Extract a block from file between two lines

I have a file/output containing this : I would like to extract all public subnet id and print them without, and white space. I used this regex And the output is : But I would like to get this instead: In fact I told sed to replace spaces and newlines with nothing (s/[[:space:]]//g) and then it also replace th…

Non-dash related bad substitution error

I am trying to write a bash script performing to find and pull somewhere else a specific file type. So far, I came up with the following script: find ./to_compress -type f -iname “*.tar” -mindepth 1 -maxdepth 1 -exec mv {} ./compressed/${{}##*/} However the bash complains that ${{}##*/} is a bad s…

BASH: How to add text in the same line after command

I have to print number of folders in my directory, so i use ls -l $1| grep “^d” | wc -l after that, I would liked to add a text in the same line. any ideas? Answer If you don’t want to use a variable to hold the output you can use echo and put your command in $( )

Extract fields from a custom xml

Im making a script to extract fields from a XML, now i got this and i need to make it work, i was trying with 2 for and greps and i need a little help with this i got this xml withs this fields and i want a output like this for make more comparations: Answer there are many issues

Why is my sed substitution with a & failing to execute?

I am trying to run following command on Linux Docker container but I am getting the following error: The file content I am running it for: I am doing it as suggested at – https://solveme.wordpress.com/2017/07/24/java-awt-awterror-assistive-technology-not-found-org-gnome-accessibility-atkwrapper-when-run…

Bash poweroff script hangs system

My intention is to cycle through my list of ips and poweroff if my ping succeeds first. However the systems seems to hang. After running this script I can’t ping the systems anymore and they aren’t powered off. If I run ssh 192.168.1.ip “sudo poweroff” through terminal I dont encounter…