0
# type repeat ;echo "this is a bash shell output"
repeat is a function
repeat () 
{ 
    local n i;
    n="$1";
    shift;
    for ((i = 1; i <= "$n"; ++i))
    do
        echo Date starting `date`;
        echo Before waiting `date`;
        sleep 6;
        echo Done waiting `date`;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        "$@";
    done
}

I would like to add this function for the alias repeat in fish shell. This alias is already available in bash shell but I would like to use the same in fish shell also. # indicates its the root user. For normal users its Fish shell which has been set as default.

devilz
  • 169
  • 1
  • 3
  • 16

1 Answers1

0
function repeat  
set n "$argv[1]";  
set m "$argv[2]";  
for i in (seq $n) ; set i $i+1  
echo "Starting date";date  
sleep 5;  
echo "Before Waiting";date  
sleep 10  
echo "After Waiting";date  
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;  
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;  
/usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;  
eval $m  
end
end  

Well this is the answer I have come up with and it works. It uses the mpv media player. Let me know if any further changes can be done.

devilz
  • 169
  • 1
  • 3
  • 16