Recent

Author Topic: Are there any bash like instructions for lazarus pascal?  (Read 4457 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Are there any bash like instructions for lazarus pascal?
« Reply #15 on: December 07, 2019, 08:57:07 pm »
This might possibly be a good time to mention the classic Kernighan & Plauger "Software Tools in Pascal" book http://seriouscomputerist.atariverse.com/media/pdf/book/Software%20Tools%20in%20Pascal.pdf

However since it dates back to when regexes were only just beginning to be accepted in any language, and completely predates Pascal's adoption of objects including TStringLists etc., it's really only suitable for the sort of masochist who thinks that Bash's scripting facilities are state of the art.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Are there any bash like instructions for lazarus pascal?
« Reply #16 on: December 08, 2019, 07:47:33 pm »
I was counting on some condescending, arrogant, accusatory answers like yours.


You kind of set the tone by your initial post.  When your first post contains "I am amazed that there are not..." and "With pascal, I have to mickey mouse around..." you're at the very least inviting similarly passioned responses.

Imagine, instead, if you had said something like: "Are there any bash or bash-like instructions for high-level languages...?"

Your post, and the attitude that appears to be associated with it (as confirmed by your response) do not really help your cause.  They literally invite people to call you out on mistaken assumptions (i.e. those are not "bash instructions") and they cause many to wonder if you understand the different between a shell scripting environment and a programming langugage.

Plus, you didn't help yourself by failing to include any information about what specific outcome you were looking to reach/obtain, or what OS and development versions you were using to do so.

Just things for you to consider...

-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

guest48704

  • Guest
Re: Are there any bash like instructions for lazarus pascal?
« Reply #17 on: January 06, 2020, 07:57:09 pm »
So, you fall right into my protest: 'I was counting on some condescending, arrogant, accusatory answers like yours.'.

Here is a good example of the ease of something I just used.

Needing to extract the lines in a file containing the words 'pattern1' and 'pattern2', all that was necessary was this fgrep instruction:

Placed  'pattern1' and 'pattern2' in <f1>.  Data file is in <f2>.

fgrep -w -f <f1> <f2>


lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Are there any bash like instructions for lazarus pascal?
« Reply #18 on: January 06, 2020, 08:25:01 pm »
Here is a good example of the ease of something I just used.

Needing to extract the lines in a file containing the words 'pattern1' and 'pattern2', all that was necessary was this fgrep instruction:

Placed  'pattern1' and 'pattern2' in <f1>.  Data file is in <f2>.

fgrep -w -f <f1> <f2>

What you don't seem to realize (and excuse me if I'm wrong) is that that is *not* a "bash instruction" but an order to bash to execute a program called fgrep, which by itself is a rather complex (and long) piece of code.

If you want you can "mimic" what bash does (execute fgrep) with a TProcess or write a set of classes/functions mimicking what fgrep itself does, though this last can quickly become a quite complex undertaking.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018