Hello again...

Pages: 1234
Imagine not programming in C++
I use Bash scripts sometimes...and I just started learning Python as well!

Ok, you can kill me now
Hey, nothing wrong with being able to program in all kinds of weird stuff. If you can grok Python and Bash that's pretty cool.

(Your bash skills are probably better than mine. I don't usually have to do much more than modify existing bash scripts, which is a whole lot easier than frobbing test for weird loop conditions all on my own. Of course, for more advanced scripting I tend to just use tclsh... which sadly doesn't come preinstalled on many modern Linuxen any more.)
I can't do anything in Python yet, except print ("Hello world!") and some other really basic stuff. But some of my co-workers use it all the time for moving large folders, and finding stuff, so I figured it could come in handy.

Isn't Bash kind of a prereq on Linux? I don't use Linux, so speaking from absolutely zero experience, but I thought you had to install/write your own applications and do most stuff from a command line until you get some GUI-based apps installed. But then my first computer in college was a brand new (back then) Powerbook, I think it was a 140, it had the weird trackball instead of a trackpad.

Off-topic a bit, but I actually preferred the trackball to the trackpad on my newer Macbook pro. It still works, or it did when I dug it out of my closet last month to see if I still had an old C program on it. It didn't, unfortunately. Oh well.
agentmax wrote:
Isn't Bash kind of a prereq on Linux? I don't use Linux, so speaking from absolutely zero experience, but I thought you had to install/write your own applications and do most stuff from a command line until you get some GUI-based apps installed.


Most Linux distro's come with a GUI software package manager. I use Fedora, it installs most of the common packages as flatpaks. There is no need to write your own app to do this. As I understand it, Arch Linux is different in that one doesn't get anything except the shell initially, so one has complete control of exactly what is installed.

Of course it is very handy to be able to do stuff with the shell as well. Using the package manager dnf from the shell is straight forward:

$ sudo dnf install <package name> #install a single package

$ sudo dnf update <package name> #update a single package

$ sudo dnf update #update the whole system


Of course there are a bunch of other options too. Other package managers such as apt on other distros are similarly easy.

It is possible to do a major upgrade (say Fedora 34 to 35) with dnf as well.

The overriding thing is not to be scared of the shell. It probably is quite intimidating reading the man page for bash: it seems complex and arcane. Personally, I don't find any worse than learning C++. One can start with easy things, then increase gradually.

The syntax seems complex, but it s very powerful, For example:

$ touch file{1..3}.tx # create 3 txt files with brace expansion (file1.txt, file2.txt, file3.txt), oops forgot the last t
$ rm fi* # remove the files we just made
$ !tou:s/tx/&t # history substitution to fix typo


Anything after the # is a comment, one wouldn't normally write them in interactive mode.

With the last command, the ! introduces a history substitution, referring to the previous command that starts with tou : our previous touch command. The :s introduces another substitution, the / delimits the start of the old string tx. The second / delimits the new string, the & is a shortcut for the old string (we want to append to it), t is the bit we want to append.

If that was too hard, one could just use the up arrow to get to the required previous command, and manually edit it.

Personally, I quite like the ability to do almost anything, it's just a matter of gradually learning the syntax.

I am not trying to convert anyone, I feel it is OK to point out some good points about the things I like :+)

Last edited on
agent max wrote:
Isn't Bash kind of a prereq on Linux? I don't use Linux, so speaking from absolutely zero experience, but I thought you had to install/write your own applications and do most stuff from a command line until you get some GUI-based apps installed.

Bash is a shell, but not the only shell. There are, for example, sh, csh, tcsh, ksh, and the already mentioned tclsh. They support different syntax and feature-sets.

Is CLI a prereq? Probably not on most distros; the distro installer is likely to offer "Desktop" option that gives you GUI off the bat.
The thing with CLI is that whatever you do interactively can probably saved as a script, which makes it trivial to run the same serie of commands again. Add parameters and conditions to the script and it becomes more generic.


A distro that has package management has CLI (and GUI) tools for downloading and installing software packages from (online) repositories. Package management offers "install", "update", and "remove". If you "install" unpackaged programs into such distro manually, then the package manager will not be aware about those files. It will not know, if you have overwritten files of some package. It will not know whether your next package install overwrites your manual changes.

You can still have your own codes/programs in, say your home directory, clearly apart from the system files.
Useful shell stuff on Windows too: ConEmu + Clink is amazing.
Especially because it gives you that same fancy command history that you get from the bash shell.

cowsay MOO
Imagine not programming in C++


That not imagination - that's the worst nightmare...
Ok, I don't know anything about Linux. But now I'm starting to get the tickle in my brain that says "Go on, try it, it could be fun..."

How does one get started with Linux? Just buy a cheap computer, wipe the OS, and download Ubuntu or whatever is the latest version?

seeplus,
Didn't you use Pascal and Fortran and things like that back in the day? Before C++ was even invented?

I honestly can't imagine a world without C++...
Last edited on
I think you can get a USB boot disk that is enough to download the rest, for typical installs.

C was around....
Lol, Pascal predates C by a (small) amount, but the GREAT 90'S RIVALRY BEGAN when Unix weenies started poo-pooing Pascal for C.

Even today you cannot find a decent Pascal compiler on C systems unless you install FPC/Lazarus. Why? Because Unix weenies thought it beneath them to play with Pascal, and those who did it were just aiming for the toy aspects of it.

Then they go and write forum posts and publish papers and get internet soapboxes to say how stupid Pascal is and how superior C and Unixen are and set up duplicitous comparisons between Pascal and 10+year newer C (and even C++).

So even though Borland Pascal made the 90s go on PCs, the world at large still wants to believe that Pascal was some backwards PL that PC lusers had to put up with if they couldn't hack it with GW-BASIC.

The reality is that Object Pascal easily outpaced C in its time, and by the time C++ caught up modern Object Pascal was already a major powerhouse in the world, even today, used by big businesses and people who like a clean, modern, powerful language.

Oh, did I mention that OP does the Unicode Right? Yep. Has done for ages now.

(Object) Pascal remains my all-time favorite language.

Don't get me wrong, it has its issues too. And I honestly like C++'s object model better. But hey, whatever.

Top 10 Fave Language Listing:

  1 Object Pascal
  2 C++
  3 Tcl
  4 Python/GDScript
5 Assembly
6 Javascript
  7 C
  8 Scheme/Racket
  9 Basic (all variants)
 10 hmm... a vacancy... Maybe Haskell? (pun intended)

NO! I do not like Java. It can dry up and die. In triplicate.
You prefer JavaScript to Java? I'd write Frobnicator frobnicator = new Frobnicator(); all day as long as I don't have to touch JavaScript. You can pry my static types from my cold dead fingers.
Javascript isn't really that hard.
You've just got to wrap your head around its really weird scoping rules...

But for simple stuff (making buttons work on webpages and the like) it is really no less straightforward than, say, PHP.

I only use it because I have to when HTML-ing.



And yes, Java is evil. It can die.
I hear C# is nice...
You could use TypeScript instead of JavaScript. It's not that JavaScript is hard, it's that it's one of the worst-"designed" languages out there. It's appropriately a microcosm of the web as a whole. An ad hoc solution which has been wantonly added to over the years with no overarching vision for the system.

Am I the only one who hates how web browsers have over the years steadily succumbed to scope creep? If I wanted an operating system inside my operating system I'd run a VM.
You're not the only one. But I don't think there is any way around it.

Remember when people were all upset when MS said that their browser was an integral part of the OS?

Funny how forward-thinking that was... lol.
By the way, I've been going through The Rust Programming Language and I'm still waiting to get to whatever it is everyone raves about. So far I haven't seen anything that couldn't be done in C++, although then one would be doing it in a much better IDE.
agentmax wrote:
How does one get started with Linux? Just buy a cheap computer, wipe the OS, and download Ubuntu or whatever is the latest version?


First up, you have said you use a Mac. So why not play with the shell in that to start with: it seems to already have bash, as well possibly ksh, tcsh, and zsh. Have you used the shell in the Mac for anything so far? It seems to me that Mac is basically another variant of Linux, with some extra stuff to make it easy to use.

https://tommcfarlin.com/shells-in-macos/

The major difference between other OS and Linux/Mac is the shell, so if Mac already has bash, I am not sure the experience is going to be that much different, apart from look and feel type stuff associated with the GUI. The name of various directories in APFS is different though, but I gather that the UNIX ones like /bin /dev /etc /sbin et al are still there.

If you do wish to have a go at Linux, the methodology doesn't have to be as extreme as what you mentioned. The simplest is to download an iso file and put it on a USB stick. Then one can put that into any computer that has a USB port, and run the whole thing from the USB by booting from it, without touching the underlying computer at all. The same USB can be used to install later if wanted.

If one wants to go further, Linux only requires a single spare partition to install on. One can use partition software to reduce the size of an existing partition if required. One can dual boot between various OS's, there can be a boot menu.

Otherwise a spare disk is a good idea, I recommend a SSD. One can have separate partitions: say / , /usr, /home, /var ,/opt etc. The advantage of that is if one partition fills up, the whole system is not compromised.

Some other considerations are which distro and spin. Ubuntu & Fedora are allegedly the most popular distros, but plenty of people use the others too. With the spins there are quite a number of them. Mainly they revolve around what is installed: one can choose from a science based type, games based etc. I like KDE, it seems to be a reasonable all rounder. I am not really a fan of gnome as a Desktop Environment: IMO they have messed with it too much, making it harder to use and it just seems dumbed down to me.

Duthomhas wrote:
NO! I do not like Java. It can dry up and die. In triplicate.


Well that made me laugh, in triplicate :+) Maybe I will poke around in it, see what all the fuss is about.
By the way, I've been going through The Rust Programming Language and I'm still waiting to get to whatever it is everyone raves about. So far I haven't seen anything that couldn't be done in C++, although then one would be doing it in a much better IDE.


That it isn't C++ !! :)
Duthomhas wrote:
And yes, Java is evil. It can die.

Agreed. I've used it a little bit, and my conclusion was that it was probably written by someone with a massive grudge for all computer programmers.

TheIdeasMan wrote:
So why not play with the shell in that to start with: it seems to already have bash, as well possibly ksh, tcsh, and zsh. Have you used the shell in the Mac for anything so far? It seems to me that Mac is basically another variant of Linux, with some extra stuff to make it easy to use.

Actually, I use the Terminal application, which uses Bash, quite a bit. I don't know if it has tcsh or any of those others; I haven't messed around with it that much. I do use it for compiling and running C++ programs, with clang++ or g++, since I don't use an IDE. I also use it for debugging, with lldb and gdb.

Ok, I tried just typing in "tcsh" into the command line, and it changed the prompt a bit:
Last login: Fri Sep 17 11:40:55 on console
freude:~ agentmax$ tcsh
[freude:~] agentmax% 

Is that what you meant?

This is weird...
freude:~ agentmax$ ksh
$ 
freude:~ agentmax$ zsh
freude% 

What does all that do?
Pages: 1234