cd script - Programming On Unix
Users browsing this thread: 2 Guest(s)
|
|||
Hey folks,
since university started two weeks back and lectures, exercises and papers are there to be read I change my directory to the current term around 10 times a day which breaks down to the following commands Code: uni /* an alias jumping to the university directory */ Of course this could be done easier by putting the following in a sources file Code: alias uni="cd $UNI_DIR && cd 17ss" But as time goes on the terms do as well so the alias must be changed in the future -> not as ugly as before, but still ugly So what about a script that gets the current term based on the last modification time, i.e., `ls -t1 $UNI_DIR | head -n1`. Nice. So I came up with the following: Code: #!/bin/bash Now I have a script which changes the directory for me, nice. Maybe it is useful for you as well. Just wanted to share :) Cheers, r4ndom -------------------- EDIT: Found a nasty bug. Code: exec bash replaces the current shell with bash (no problem for me, since I'm using bash anyways). But if you `exit` you enter the former shell again. Why is this happening? This is not the way replacement works or am I missing something? |
|||
Messages In This Thread |
cd script - by r4ndom - 03-05-2017, 06:35 AM
RE: cd script - by venam - 03-05-2017, 07:27 AM
RE: cd script - by darthlukan - 03-05-2017, 12:19 PM
RE: cd script - by r4ndom - 03-05-2017, 04:36 PM
RE: cd script - by venam - 04-05-2017, 12:08 AM
RE: cd script - by rocx - 04-05-2017, 12:46 PM
RE: cd script - by z3bra - 04-05-2017, 07:19 PM
|