You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Installing alternate shell - is it possible, and would you recommend it?

Author (Read 4200 times)

0 Members and 1 Guest are viewing this topic.

 

Vera

  • PayPal Supporter
  • Forum Regular
  • *****
  • 140
    Posts
  • Reputation: 16
  • Enjoying Linux Lite.
    • View Profile

  • CPU: Intel Quad Core 1.6GHz

  • MEMORY: 8Gb

  • VIDEO CARD: AMD Radeon
OK, to update the results. All went fine! I installed the fish shell via the Synaptic package manger. This was not on a VM, it was on my real LL 4.0 machine (I'd backed up user data onto a USB drive first). Please note, I did NOT set up fish as my login shell, just to be safe! I'm only planning to use fish when I do scripting.

OK, here is a case in point where I'm comparing bash and fish on the "if" statement, where bash falls down under a certain condition (just a comment inside the 'if').

The "date" command in the script is just so we know when we've gone past the if statement and gotten to the end of the script.

BASH:
Here is a bash script I made called test-if-comment.bash:

Code: [Select]
#!/bin/bash
mynumber=3
if [ $mynumber -eq 3 ]
then
# we only want a comment here
 fi
date

Here is the output of test-if-comment.bash:

./test-if-comment.bash: line 6: syntax error near unexpected token `fi'
./test-if-comment.bash: line 6: ` fi'

 The output is an error because it doesn't like to have an if statement containing only a comment. This is exactly why I don't like bash. This sort of thing makes me want to cry!

So in order to have the thing run, I need to put something else other than just a comment inside the if statement. OK, let's try putting an echo statement in there.

We will call this file test-if-comment-echo.bash

Code: [Select]
#!/bin/bash
mynumber=3
if [ $mynumber -eq 3 ]
then
# we only want a comment here but we have to put something else in
echo "Placeholder text"
 fi
date

Here is the output of test-if-comment-echo.bash - it's what we would expect:

Placeholder text
Sat Jun  9 15:08:39 EDT 2018


FISH

OK, let's try the equivalent of the first shell script but in fish. We'll call it test-if-comment.fish

Code: [Select]
#! /usr/bin/fish
set mynumber 3
if test $mynumber -eq 3
# we only want a comment here
 end
date

Here is the output of test-if-comment.fish - evidently the fish shell is fine with just a comment inside the if statement:

Sat Jun  9 15:11:28 EDT 2018

I also tested the fish script with an echo inside the if statement as well as the comment, just to make sure it was working properly, and it was.

I think I will be sticking with fish for my scripting needs. It seems to work more intuitively for me.
Using Linux Lite for everything now. I put it on my desktop and my laptop. Woohoo!
 

 

Vera

  • PayPal Supporter
  • Forum Regular
  • *****
  • 140
    Posts
  • Reputation: 16
  • Enjoying Linux Lite.
    • View Profile

  • CPU: Intel Quad Core 1.6GHz

  • MEMORY: 8Gb

  • VIDEO CARD: AMD Radeon
Thanks so much for your answers @Jerry and @trinidad . I'm thinking carefully on this. OK then Jerry, if I try it, I will either try it on VM, or I will back up my current files on USB so that if my system breaks I will be able to do a fresh install of LL 4.0 without losing any important data. (I'm backing up my and the other user files as we speak!)

Trinidad - I read the article you recommended. In particular, I noticed that it said "The more advanced shells tend to take up extra CPU, since they work in cbreak mode". This concerned me a little, so I'm thinking about whether I want to try it out or not. If I do, I would not make it a login shell, which I realize is risky. It was certainly helpful to get this background. Thank you.

I also started reading about the fish shell, which is a newer shell that I hadn't heard of before. From what I see from its website https://fishshell.com/ it looks pretty good. It's on Synaptic as well. I'm not installing anything yet, I'm thinking about the ramifications. Thanks again Jerry and Trinidad for this helpful advice.
Using Linux Lite for everything now. I put it on my desktop and my laptop. Woohoo!
 

 

trinidad

  • Platinum Level Poster
  • **********
  • 1471
    Posts
  • Reputation: 214
  • Linux Lite Member
    • View Profile
    • dbts-analytics.com

  • CPU: i7 4 cores 8 threads

  • MEMORY: 16Gb

  • VIDEO CARD: Intel HD graphics

  • Kernel: 5.x
Opinions do not vary much concerning csh. Better off with bash and dash. If you want to devote time to something, it's better for you to expend your effort on the better shell and better syntax. I'm not a developer, and I still make mistakes with query definitions and </> entries switching back and forth from Debian and Apache and I use nano  a lot more than I should. When you add html5, php, and a few other syntaxes in it's confusing enough and hard enough on the eyes just using 2 shells. Unix doesn't really have a static form anymore anyway, so stick with bash, where the improvements are always being made.

http://www.faqs.org/faqs/unix-faq/shell/shell-differences/

TC
All opinions expressed and all advice given by Trinidad Cruz on this forum are his responsibility alone and do not necessarily reflect the views or methods of the developers of Linux Lite. He is a citizen of the United States where it is acceptable to occasionally be uninformed and inept as long as you pay your taxes.
 

 

Jerry

  • Linux Lite Creator
  • Administrator
  • Platinum Level Poster
  • *****
  • 8778
    Posts
  • Reputation: 802
  • Linux Lite Member
    • View Profile
    • Linux Lite OS

  • CPU: Intel Core i9-10850K CPU @ 3.60GHz

  • MEMORY: 32Gb

  • VIDEO CARD: nVidia GeForce GTX 1650

  • Kernel: 5.x
Unknown effects Vera. You should trial it in a VM first.

Sent from my Mi Max using Tapatalk

 

Installing alternate shell - is it possible, and would you recommend it?
« Reply #1 on: June 09, 2018, 12:21:59 PM »
 

Vera

  • PayPal Supporter
  • Forum Regular
  • *****
  • 140
    Posts
  • Reputation: 16
  • Enjoying Linux Lite.
    • View Profile

  • CPU: Intel Quad Core 1.6GHz

  • MEMORY: 8Gb

  • VIDEO CARD: AMD Radeon
I'm considering installing csh or tcsh on my LL 4.0 system - not as my main shell, but to use on the rare occasions when I do shell scripting. I notice those additional shells are available in the Synaptic package manager. That said,

a) would installing csh (or tcsh) be likely to screw up anything that is pre-existing on my system?
b) would you recommend installing csh/tcsh? (a totally different question, I know).

I'd love to get some guidance from the LL community on either or both of these questions. Please answer as little or as much as you are willing to - any information is helpful here.

Optional background - only read if you want to know this: The reason I am even considering a csh-based system for scripting is that I used it years ago on Unix. It "made sense" to me in a way that bash (still) doesn't, but possibly that's just because csh / tcsh was the first shell I ever used. I guess I wanted to see if going back to one of those shells would make me feel more "at home" when I do any scripting.

« Last Edit: June 09, 2018, 03:20:53 PM by Vera »
Using Linux Lite for everything now. I put it on my desktop and my laptop. Woohoo!
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section