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.

5
  • try this under the function: alias repeat='repeat' Mar 14, 2017 at 15:33
  • want me to type it after > or inside a file ?
    – devilz
    Mar 14, 2017 at 15:37
  • Let me get you right you want thsi written in fish shell syntax? Mar 14, 2017 at 15:38
  • yeah it needs to be written in fish shell syntax as repeat alias
    – devilz
    Mar 14, 2017 at 15:38
  • try my updated and let me know... Mar 14, 2017 at 15:42

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .