#!/bin/bash # sudo systemctl daemon-reload sudo systemctl restart remote-fs.target sudo systemctl restart local-fs.target #
Category: Programming
Programming tips….
readpw (password input prompt, displaying ** when typing)
use Term::ReadKey; sub readpwd { # # Get the variables #– ($prompt)=@_; $key=0; $password=””; # print $prompt . ” : “; # Start reading the keys ReadMode(4); #Disable the control keys while(ord($key = ReadKey(0)) != 10) # This will continue until the Enter key is pressed (decimal value of 10) { # For all […]
3 subs to trim text
To trim text you can use the following. sub ltrim { my $s = shift; $s =~ s/^\s+//; return $s }; sub rtrim { my $s = shift; $s =~ s/\s+$//; return $s }; sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };