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
 


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.
 
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:
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.
 
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'
 
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:
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:
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'
 
#!/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);
 
#!/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;
 
The syntax in php is different. Haven't done this in a while. Give me a bit to fix this.
 

Members online


Top