Similar questions come up on TB often enough, and I've provided the same answer each time (cut and pasted below this paragraph). This exercise really helped me learn how to move around the fretboard through chord changes, and gets your hands familiar with the shapes of the different modes.
If you want to learn how to move around your fretboard and construct bass lines over chord changes, learn your modes. I have a warm up that I play almost daily, where I play all the modes of C major (aka C ionian) in sequence, starting from C major on the third fret of the A string, D dorian on the 5th fret of the A string, then move to E phrygian on the open E and work your way back to C major. I won't write them all out here, but these are the names in order (you can easily find tabs/notation for the scales online).
C major, D dorian, E phrygian, F lydian, G mixolydian, A aeolian, B locrian