Search Results

Search: Posts Made By: squrcles
1,111
Posted By Scott
/etc/services lists what (default) ports are...
/etc/services lists what (default) ports are mapped to which services. There are various commands (netstat, telnet, nmap, etc.) to help identify which ports are open.
1,334
Posted By Yoda
A shell variable name must begin with...
A shell variable name must begin with alphanumeric character or underscore character followed by one or more alphanumeric or underscore characters.

So try without that period:-
zone_5.org
1,708
Posted By ahamed101
Try this df -h | awk '$5+0 > 45' If it...
Try this
df -h | awk '$5+0 > 45'
If it doesn't work, provide the output of df -h

And in Solaris, use nawk
1,581
Posted By jim mcnamara
Unless you are root on the remote server, su will...
Unless you are root on the remote server, su will ask for a password. So I don't quite get what you are seeing.

Try this:
ssh -t usera@hosta sudo 'su - userb -c id'
1,581
Posted By vbe
Thats exactly what Jim said in post #2 I...
Thats exactly what Jim said in post #2
I understand you ar not root then... You will have to see with your admins if then can correct the sudoers files for your requirement...
1,412
Posted By Corona688
You can cram as many directories as you want into...
You can cram as many directories as you want into one find, no need to run it repeatedly. You may wish to redirect stderr in case some of them don't exist ... 2>/dev/null
1,412
Posted By Corona688
VAR="$(ssh -T -i /home/buddy/.ssh/id_rsa...
VAR="$(ssh -T -i /home/buddy/.ssh/id_rsa buddy@ginger find ${the_path} -name "*.jpg" '|' wc -l)"
3,325
Posted By wisecracker
You might like... ;o) Much related you could...
You might like... ;o)
Much related you could try this as an added extra:-
Last login: Mon Sep 30 19:34:05 on ttys000
AMIGA:barrywalker~> clear; star=""; i='-\|/*'; for k in {0..9}; do for j in...
3,727
Posted By Jotne
The backticks have been deprecated in favor of...
The backticks have been deprecated in favor of $() for command substitution because $() can easily nest within itself as in $(echo foo$(echo bar)). There are also minor differences such as how...
3,727
Posted By Jotne
And if possible, replace all back tics `` with...
And if possible, replace all back tics `` with parentheses $()
if ! [ $(uptime | grep -q day) ]
3,727
Posted By krishmaths
Try replacing if [ ! `uptime | grep day` ] with ...
Try replacing if [ ! `uptime | grep day` ] with


if ! [ `uptime | grep -q day` ]
1,693
Posted By Scrutinizer
Actually, that is extended pattern matching, not...
Actually, that is extended pattern matching, not a regular expression.

A pattern-list is a list of one or more patterns separated from each
other with a & or |. A & signifies...
6,202
Posted By RudiC
This may be it :awk '/https:\/\// {gsub...
This may be it :awk '/https:\/\// {gsub (/https:\/\//, ""); print}' file
www.amazon.com
www.google.com
6,202
Posted By Scott
$ sed "s#^https://##" file www.amazon.com ...
$ sed "s#^https://##" file
www.amazon.com
Help.com
www.google.com
http://www.bbc.com


Or


$ sed "s#^[^/]*//##" file
www.amazon.com
Help.com
www.google.com
www.bbc.com
3,936
Posted By verdepollo
function function1() { case $1 in 1)...
function function1() {
case $1 in
1) do something ;;
2) do other something ;;
[3-9]) do some other something ;;
esac
}

call it with function1 $opt1
17,736
Posted By Corona688
Better way, using pure shell builtins and...
Better way, using pure shell builtins and splitting on array elements:
printf "%s\n" "${ARRAY[@]}"
17,736
Posted By rajamadhavan
#!/bin/ksh arrayname=(1 2 3 4 5) echo...
#!/bin/ksh
arrayname=(1 2 3 4 5)
echo ${arrayname
} | tr " " "\n"
2,310
Posted By Scrutinizer
Try: for z in $x do case $y in ...
Try:
for z in $x
do
case $y in
*$z*) echo "a pattern in \$y matches any pattern in \$x"; break
esac
done
2,310
Posted By RudiC
Recent kshs (as well as bashes) provide a regex...
Recent kshs (as well as bashes) provide a regex match in conditional expressions. man ksh:So your code could read:x="aa bb cc dd ee ff gg hh ii jj kk ll"
y="ff kk"
$ for z in $x; do [[ "$y" =~...
2,310
Posted By MadeInGermany
If 'pattern' stands for 'word' and 'match' for...
If 'pattern' stands for 'word' and 'match' for 'is equal to', then nested loops seem most correct.
for x1 in $x; do
for y1 in $y; do
if [ "$x1" = "$y1" ]; then
echo "$x1"
fi
done
done
1,693
Posted By vgersh99
#!/usr/bin/ksh hostname="${1}" if [[...
#!/usr/bin/ksh

hostname="${1}"

if [[ "${hostname}" = @(red|black|green|yellow|blue) ]] ; then
echo "${hostname} - match"
else
echo "${hostname} - no match"
fi
Showing results 1 to 21 of 21

 
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy