I've never been very good at bash, but usually I get things done on the rare occasion that I need to. This challenge however, is beyond me.
In this case the desired output would be:
I have tried a number of approached, but none of them have worked out, all of them have been overly complex, and think the reason basically is that I haven't the slightest clue what I'm doing, and am taking the wrong approach.
Don't get me wrong, I can do this, and have done so using both awk and C, so regardless I have a solution, but I would really like to know where I'm going wrong.
I know I haven't provided much in term of example code, but the reason is simply that nothing really works. It's not just a matter of syntax error or similar, it's me doing something fundamentally wrong.
Anyway, if you have something to add, I'd like to hear it. I know it isn't really a question as such, but here goes anyway.
Best regards.
Code:
#!/bin/bash farr0=("#####" " #" "#####" "#####" "# #" "#####" "# " "#####" "#####" "#####" " #" " ") farr1=("# #" " #" " #" " #" "# #" "# " "# " " #" "# #" "# #" " # " " # ") farr2=("# #" " #" "#####" "#####" "#####" "#####" "#####" " #" "#####" "#####" " # " " ") farr3=("# #" " #" "# " " #" " #" " #" "# #" " #" "# #" " #" " # " " # ") farr4=("#####" " #" "#####" "#####" " #" "#####" "#####" " #" "#####" " #" "# " " ") function print_datetime { datetime=`date '+%Y%m%d%H%M%S'` for i in {0..4} do # What I'd like: (example for year only) # echo -n ${farr{$i}[$datetime[0]]} # echo -n ${farr{$i}[$datetime[1]]} # echo -n ${farr{$i}[$datetime[2]]} # echo -n ${farr{$i}[$datetime[3]]} done } print_datetime
Code:
##### ##### # ##### # # # # # ##### # # # ##### # # # # # ##### ##### # #####
Don't get me wrong, I can do this, and have done so using both awk and C, so regardless I have a solution, but I would really like to know where I'm going wrong.
I know I haven't provided much in term of example code, but the reason is simply that nothing really works. It's not just a matter of syntax error or similar, it's me doing something fundamentally wrong.
Anyway, if you have something to add, I'd like to hear it. I know it isn't really a question as such, but here goes anyway.
Best regards.
Comment