Skip to content

Tag: scripting

python filter lines matching keyworks

I have working python script producing following output. Script output Now i want want any line starting with stream in output so i am using following logic but its not working. Answer Your data is a massive string instead of a list of strings as you expected. Also it’s easier to use str.startswith inst…

Bash Scripting checking for home directories

I’m trying to create a script to check if user accounts have valid home directories. This is what i got at the moment: This works. I get the expected output which is the username of the account with an invalid home directory. eg. output However, I am unable to make it so that ONLY if there is no issues …

Extra percent sign appears in echo bash

I’ve got the following script below which is supposed to demo CPU utilization: For some reason, when the percentage is echoed out, two percent signs appear instead of the last digit of the number and a percent sign. For example, the output is sometimes 2.7%% instead of 2.72%. Everything works fine when …