Search Results

Search: Posts Made By: frintocf
2,385
Posted By Scrutinizer
No, the regex equivalent of the second example...
No, the regex equivalent of the second example would be:
grep '^[a-zA-Z][a-zA-Z0-9_-]*$'
2,385
Posted By Scrutinizer
Oops, you are right. The OP is using extended...
Oops, you are right. The OP is using extended pattern matching (like extended globbing). Hadn't even noticed that..
For those testing with bash first execute:
shopt -s extglob
(in recent ksh93...
2,385
Posted By methyl
It is validating the string $answer. It checks...
It is validating the string $answer. It checks whether the string starts with an alphabetic character and that every other character is alphanumeric or a hyphen or an underscore.

To be 100% sure...
2,385
Posted By michaelrozar17
Thanks Scruti and ygemici. I got the same error...
Thanks Scruti and ygemici. I got the same error -bash: [: too many arguments as ygemici but after placing the quotes around RHS the error went off. Hence i assumed that we would need to quote the RHS.
2,385
Posted By Scrutinizer
@ michael: the double quotes on the RHS of the...
@ michael: the double quotes on the RHS of the expression should be removed at any case otherwise the characters will be interpreted as string. Also, the RHS will not be evaluated using regex but by...
2,385
Posted By ygemici
check these if [[ $answer !=...
check these
if [[ $answer != [a-zA-Z]*[a-zA-Z0-9_-] ]]; then echo ok; fi
ok


from the bash manual it says for [[ expression ]]
Any part of the pattern may be quoted to force it to be matched...
2,385
Posted By michaelrozar17
Giving double square brackets is not wrong, the...
Giving double square brackets is not wrong, the if statement would do the regular test. For more information read link1 (https://www.unix.com/302076732-post.html#post302076732)and link2...
2,686
Posted By kalpeer
You can add this condition in your default...
You can add this condition in your default profile file(~/.profile or ~/.kshrc or ~/.cshrc)
Since when the user login profile gets executed.
10,451
Posted By frank_rizzo
#!/usr/bin/perl $|++; #set STDOUT unbuffered;...
#!/usr/bin/perl
$|++; #set STDOUT unbuffered; use with caution
print "check 1";
print "check 2";
sleep 5;
10,451
Posted By balajesuri
#!/usr/bin/perl print "check 1"; print "check...
#!/usr/bin/perl
print "check 1";
print "check 2\n";
sleep 5;
10,564
Posted By h@foorsa.biz
Yes in some ways they are the same functionality...
Yes in some ways they are the same functionality they intend to compress data.
Some do better than others e.g gzip is better than compress and pack in overall .

compress and gzip are alike in...
994
Posted By itkamaraj
when you normally execute the above command, it...
when you normally execute the above command, it will give the output in terminal

`raidconfig list raid -v`

why do you put echo ?

just put the below in your shell script

`raidconfig...
1,647
Posted By Skrynesaver
If the grep comes back empty it means that you...
If the grep comes back empty it means that you are comparing "X" with "X" rather than a blank with a pattern, it's a hang over in my style from shells that fell over if there was an empty string on...
1,647
Posted By Skrynesaver
#!/bin/bash hw_plf_desc=$(grep hw_platform...
#!/bin/bash
hw_plf_desc=$(grep hw_platform $NODE_CFG_FILE)
if [ "X$(echo $hw_plf_desc | grep 'Netra X4270 X4446A M2')" == "X" ] ; then
echo "Not a Nextra X4270 X4446A M2"
else
echo...
11,480
Posted By methyl
Reference post #5. Did it fail? On the surface...
Reference post #5. Did it fail? On the surface the code looks ok.
Just in case you have a weird system, what do you get for:
file /usr/bin/bash

Afterthought. You did create a shell script...
11,480
Posted By bartus11
Try: cd /tmp;find . -name "*.log" | xargs -i bash...
Try: cd /tmp;find . -name "*.log" | xargs -i bash -c "echo {} | cpio -pdmu /tmp/arc; rm -f {}"
1,043
Posted By radoulov
Just to add that you'll need to actually go to...
Just to add that you'll need to actually go to the target directory:

cd /tmp
find . ! -name . -prune -type fOtherwise you should use something like this:

find /tmp/. ! -name . -prune -type f...
1,043
Posted By radoulov
find . ! -name . -prune -type f With zsh: ...
find . ! -name . -prune -type f

With zsh:

print -l -- *(D.)
Showing results 1 to 18 of 18

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