Portál AbcLinuxu, 12. května 2024 02:44
alias xm shutdown test='virsh -c qemu:///system shutdown test' alias xm create test.cfg='virsh -c qemu:///system start test' alias xm reboot test='virsh -c qemu:///system restart test'Poprosim nevyjadrovat sa ku tomuto rieseniu, je to takto riesene z istych dovod ktore nechcem rozoberat. Dakujem.
function xm() { case "$1 $2" in 'shutdown test') virsh -c qemu:///system shutdown test ;; 'create test.cfg') virsh -c qemu:///system start test ;; 'reboot test') virsh -c qemu:///system restart test ;; *) virsh -c qemu:///system $@ # Co pak? ;; esac }
Řešil bych to spíš nějakou funkcíuz 10 let stary Bash popisuje, ze 'alias' jsou prekonana 'feature' a maji se nahradit shell funkcema. For almost every purpose, aliases are superseded by shell functions.
Tiskni Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.