ls -l drwxr-xr-x 2 root root 4,0K Μάρ 29 15:18 bin drwxr-xr-x 2 root root 4,0K Μάρ 29 13:55 log lrwxrwxrwx 1 root root 23 Μάρ 29 15:25 playlists -> /home/music/songs.xmas drwxr-xr-x 3 root root 4,0K Μάρ 27 09:30 playlists.all drwxr-xr-x 2 root root 4,0K Μάρ 27 09:30 playlists.easter drwxr-xr-x 2 root root 4,0K Μάρ 27 09:30 playlists.general drwxr-xr-x 2 root root 4,0K Μάρ 27 09:26 playlists.xmas lrwxrwxrwx 1 root root 23 Μάρ 29 15:25 songs -> /home/music/songs.xmas drwxr-xr-x 2 root root 48K Μάρ 29 14:47 songs.all drwxr-xr-x 2 root root 4,0K Μάρ 29 14:59 songs.easter drwxr-xr-x 2 root root 4,0K Μάρ 27 09:30 songs.general drwxr-xr-x 2 root root 12K Μάρ 27 09:26 songs.xmas drwxr-xr-x 3 root root 4,0K Μάρ 27 09:19 tmp ---------------------------------- Linuxula bin # ./chseason 1 all 2 easter 3 general 4 xmas The current season is: xmas xmas To change the season type a number and press [ENTER] 2 Current Season Now Is: easter easter ---------------------------------- #!/bin/sh ############################ ### Show Seasons ls --color=none /home/music | grep songs. | sed 's/\./ /g' | awk '{print $2}' | nl ############################ ### Current Season current=`ls -l --color=none /home/music | grep -e "->" | grep -e "songs" | sed 's/\./ /g' | awk '{print $12}'` ############################ #### Ask user echo echo -e "The current season is: $current" echo -e "To change the season type a number and press [ENTER]" read season ############################ ### Create paths cur_song=`ls -l --color=none /home/music | grep -e "playlists." | grep -v "\->" | sed 's/\./ /g' | nl | grep -e "\ \ \ \ $season" | awk '{print $11}'` cur_play=`ls -l --color=none /home/music | grep -e "songs." | grep -v "\->" | sed 's/\./ /g' | nl | grep -e "\ \ \ \ $season" | awk '{print $11}'` ############################ ### Change Links rm /home/music/songs &> /home/music/log/chseason.log rm /home/music/playlists &> /home/music/log/chseason.log ln -sf /home/music/songs.$cur_song /home/music/songs &> /home/music/log/chseason.log ln -sf /home/music/songs.$cur_play /home/music/playlists &> /home/music/log/chseason.log ############################# ### Show Results current=`ls -l --color=none /home/music | grep -e "->" | grep -e "songs" | sed 's/\./ /g' | awk '{print $12}' | awk '{print $1}'` echo -e "Current Season Now Is: $current"