is there a *.* in Linux just like in Windows?

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
Hello there,

Like the title says. is there a thing that does the same job like in Windows?

Any help would be much appreciated.

Thanks in advance.

Sinan
 


KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,482
Reaction score
5,741
Credits
52,149
Yes, wildcards work in Linux. (Assuming that's what you mean.)

*.* would be <any_string>.<any_string> so foo.bar and foo1.bar and foo3.bar are all candidates for a command that's using *,* as a query.
 
OP
E

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
Well, I will try to explain what I want to achive in a simple way :)

So, I have a folder that has many files, some with .log extention and other with .leases extention.

And I have this comand line: exec('openssl ts -verify -data /tmp/' . $log_type . '.log -in /tmp/' . $log_type . '.l*.der -token_in -CAfile /CA/cacert.pem -untrusted /CA/tsacert.pem', $result);

So when I run the above comand line it will start varification process only on the files that has .log extention.

And if I change the .log that is marked bold in the above comand line with .leases and then re run the comand line then it start the same varification process but this time only on the files that has .leases extention.

So What I want here is that when ever I run the comand line it detects all the files in the folder and start the verification process, no matter it is .log or .leases extention.

So what is the thing I should write in the place of the bold marked .log to make it detect any extention? I have tried *.* or '.' or * or .l* but non of these worked for me thats why I asked what is the thing in Linux that looks similar to *.* in windows.
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,482
Reaction score
5,741
Credits
52,149
I don't have time to experiment right now, but what you're asking doesn't look too hard. Someone may be along to hook you up and get you squared away.
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,455
Reaction score
1,061
Credits
9,014
It would help to know what all is in the directory.

In Linux * = *.* * is everything.
If you want logs *.log
If you you want leases *.lease

If you want both at same time, probably easiest to use grep.

ls | grep -E 'log|lease'
 
OP
E

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
Maybe brace expansion would work here? What happens if you replace .log with {.log,.leases}
Hi, Thanks for your reply

replacing .log with {.log,.leases} didnt work.

did the replace like this:

exec('openssl ts -verify -data /tmp/' . $log_type . '{.log,.leases} -in /tmp/' . $log_type . '.l*.der -token_in -CAfile /CA/cacert.pem -untrusted /CA/tsacert.pem', $result);
 
Last edited:
OP
E

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
It would help to know what all is in the directory.

In Linux * = *.* * is everything.
If you want logs *.log
If you you want leases *.lease

If you want both at same time, probably easiest to use grep.

ls | grep -E 'log|lease'

that is what in the directory:

1657212712039.png
1657212761296.png
 
Last edited:
OP
E

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
It would help to know what all is in the directory.

In Linux * = *.* * is everything.
If you want logs *.log
If you you want leases *.lease

If you want both at same time, probably easiest to use grep.

ls | grep -E 'log|lease'
Im new to linux so can you tell where to add ls | grep -E 'log|lease'
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,455
Reaction score
1,061
Credits
9,014
#!/usr/bin/bash
log_type=$(ls | grep -E 'log|lease')
exec('openssl ts -verify -data /tmp/' . $log_type . '.log -in /tmp/' . $log_type . '.l*.der -token_in -CAfile /CA/cacert.pem -untrusted /CA/tsacert.pem', $result);
 
OP
E

egzozcu

New Member
Joined
Jul 6, 2022
Messages
6
Reaction score
0
Credits
57
#!/usr/bin/bash
log_type=$(ls | grep -E 'log|lease')
exec('openssl ts -verify -data /tmp/' . $log_type . '.log -in /tmp/' . $log_type . '.l*.der -token_in -CAfile /CA/cacert.pem -untrusted /CA/tsacert.pem', $result);
getting this error when apply the above lines :

Parse error: syntax error, unexpected '=' in /usr/local/www/log_browser/dogrula.php on line 12


this is the whole lines inside dogrula.php file

<?php

$file = $_POST['file'];
$exploded = explode('.', basename($file));
$log_type = $exploded[0];

chdir('/tmp');
exec('cp /var/imzali_kayitlar/' . $file . ' ./');
exec('tar zxvf ' . basename($file));
// DoÄŸrulama komutu

log_type = $(ls | grep -E 'log|leases')
exec('openssl ts -verify -data /tmp/' . $log_type . '.log -in /tmp/' . $log_type . '.l*.der -token_in -CAfile /CA/cacert.pem -untrusted /CA/tsacert.pem', $result);

if ($result[0] == 'Verification: OK') {
$imza = file_get_contents($log_type . '.log.imza');
echo '<p class="success">Doğrulama başarılı!</p>';
echo '<div>' . nl2br($imza) . '</div>';
}
else {
echo '<p class="error">Doğrulama başarısız!</p>';
}

exec('rm ' . $log_type . '.l*');
exit;
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,455
Reaction score
1,061
Credits
9,014
The syntax in php is different. Haven't done this in a while. Give me a bit to fix this.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation


Top