$ echo "echo "blabla"> test.bat $ ./test.bat blabla $ sh test.bat blabla $ /home/nbah/test.bat blabla...
Citation
nbah
heu... la bille de bois qui me sert de tête n'est pas d'accord.
bash non plus :
(`echo` était un mauvais exemple, puisqu'il existe pour les deux systèmes). J'aurais dû ajouter uniquement.Citation
et "lister" des commandes linux
kwrite tonscript.sh
#!/bin/bash
if "%OP_CERT_COUNTRY%" == "" goto edit_script if "%OP_CERT_STATE%" == "" goto edit_script if "%OP_CERT_LOCALITY%" == "" goto edit_script if "%OP_CERT_ORG%" == "" goto edit_script if "%OP_CERT_CA_DAYS%" == "" goto edit_script if "%OP_CERT_CERT_DAYS%" == "" goto edit_script shift if "%0" == "" goto help if "%0" == "help" goto help if "%0" == "dsaparam" goto dsaparam if "%0" == "gencakey" goto gencakey if "%0" == "genmanager" goto genmanager
goto end :help echo usage: op_cert command echo. echo commands: echo dsaparam: generates DSA parameters echo gencakey: generates the certificate authority's private and public keys echo genmanager: generates the certificates used by the capture manager echo help: displays this text echo. echo Certificate generation requires generating the DSA parameters first. echo If the DSA parameter file (dsaparam.pem) already exists, there is no echo need to generate a new DSA parameter file. goto end :dsaparam openssl dsaparam -outform PEM -out dsaparam.pem 1024 goto end :gencakey ECHO. ECHO =========================================== ECHO Generating the private and public keys for the certificate authority. This operation only needs to be done once. ECHO Enter the same passphrase three times.This passphrase should be kept secure. ECHO ============================================== ECHO. echo [ req ] > openssl.cnf echo default_bits = 1024 >> openssl.cnf echo default_keyfile = privkey.pem >> openssl.cnf echo distinguished_name = req_distinguished_name >> openssl.cnf echo prompt = no >> openssl.cnf echo [ req_distinguished_name ] >> openssl.cnf echo C = %OP_CERT_COUNTRY% >> openssl.cnf echo ST = %OP_CERT_STATE% >> openssl.cnf echo L :end set OP_CERT_COUNTRY= set OP_CERT_STATE= set OP_CERT_LOCALITY= set OP_CERT_ORG=
if "%OP_CERT_COUNTRY%" == "" goto edit_script if "%OP_CERT_STATE%" == "" goto edit_script if "%OP_CERT_LOCALITY%" == "" goto edit_script if "%OP_CERT_ORG%" == "" goto edit_script if "%OP_CERT_CA_DAYS%" == "" goto edit_script if "%OP_CERT_CERT_DAYS%" == "" goto edit_script
echo op_cert: please edit the environment variables at the start of this script file
if [ "$OP_CERT_COUNTRY" == "" || "$OP_CERT_LOCALITY" == "" || "$OP_CERT_ORG" == "" || "$OP_CERT_CA_DAY" == "" || "$OP_CERT_CERT_DAYS" == "" ]; then echo please edit the environment variables at the start of this script file exit fi
if "%0" == "" goto help if "%0" == "help" goto help if "%0" == "dsaparam" goto dsaparam if "%0" == "gencakey" goto gencakey if "%0" == "genmanager" goto genmanager
#!/bin/bash OP_CERT_COUNTRY=CA #Specify your state or province OP_CERT_STATE=QC #Specify your city OP_CERT_LOCALITY=Trois-Rivieres #Specify your company's name OP_CERT_ORG=UQTR #This is the expiration for the CA and public certificates created by the CA; often will be 10 years or more. OP_CERT_CA_DAYS=3650 #This is the expiration for the Capture Manager certificates; might be 1 day, 30 days, etc., depending on policy. OP_CERT_CERT_DAYS=200 #Test de l'alimentation des variables if [ "$OP_CERT_COUNTRY" == "" || "$OP_CERT_LOCALITY" == "" || "$OP_CERT_ORG" == "" || "$OP_CERT_CA_DAY" == "" || "$OP_CERT_CERT_DAYS" == "" ]; then echo "please edit the environment variables at the start of this script file" exit fi # Test de l'option de ton script case $1 in help) echo "usage: op_cert command" echo "commands:" echo "dsaparam: generates DSA parameters" echo "gencakey: generates the certificate authority's private and public keys" echo "genmanager: generates the certificates used by the capture manager" echo "help: displays this text" echo "Certificate generation requires generating the DSA parameters first." echo "If the DSA parameter file (dsaparam.pem) already exists, there is no" echo "need to generate a new DSA parameter file." ;; dsaparam) openssl dsaparam -outform PEM -out dsaparam.pem 1024 ;; gencakey) echo "==============================================" echo "Generating the private and public keys for the certificate authority. This operation only needs to be done once." echo "Enter the same passphrase three times. This passphrase should be kept secure." echo "==============================================" echo "[ req ]" > openssl.cnf echo "default_bits = 1024" >> openssl.cnf echo "default_keyfile = privkey.pem" >> openssl.cnf echo "distinguished_name = req_distinguished_name" >> openssl.cnf echo "prompt = no" >> openssl.cnf echo "[ req_distinguished_name ]" >> openssl.cnf echo "C = $OP_CERT_COUNTRY" >> openssl.cnf echo "ST = $OP_CERT_STATE" >> openssl.cnf echo "L = $OP_CERT_LOCALITY" >> openssl.cnf echo "O = $OP_CERT_ORG" >> openssl.cnf echo "CN = CA" >> openssl.cnf openssl req -config openssl.cnf -newkey dsa:dsaparam.pem -sha1 -keyout cakey.pem -outform PEM -out careq.pem openssl x509 -req -inform PEM -in careq.pem -sha1 -signkey cakey.pem -outform PEM -out ca.pem -days $OP_CERT_CA_DAYS cp ca.pem cakey.pem casign.pem rm -f cakey.pem careq.pem echo "==============================================" echo "This certificate will expire in $OP_CERT_CA_DAYS days." echo "==============================================" ;; genmanager) #ici c'est un peu la même fonction que gencakey *) echo "usage: op_cert command" echo "commands:" echo "dsaparam: generates DSA parameters" echo "gencakey: generates the certificate authority's private and public keys" echo "genmanager: generates the certificates used by the capture manager" echo "help: displays this text" echo "Certificate generation requires generating the DSA parameters first." echo "If the DSA parameter file (dsaparam.pem) already exists, there is no" echo "need to generate a new DSA parameter file." ;; esac
Ne s'agit-il pas là d'une concaténation ?Citation
chrystelle
copy managercert.pem+managerkey.pem+ca.pem cert.pem
cat managercert.pem managerkey.pem ca.pem > cert.pem...