• We did not send an email asking for donations - please read this post.

bash

  1. K

    bash script, find amount of strings in files

    Hello everyone! I am writing script which must count amount of strings in files .z format. Name of folder can changes in dependence of current date, if it's 1-st date of the month script count amount in folder which is called 2210 (previous month ) if today is not 1-st day of month then folder...
  2. pedro.de.marco

    bash translation

    Greetings. . I need to convert a normal bash file, which in this case it's a "dockerfile" or docker build file from Arch to Debian. Is there any lazy script hanging around on github that fellow users are aware of ? Any app that converts these commands from a distro-specific to another ? (there r...
  3. F

    Edit .bashrc file so *every* command output is piped in to a specific command

    No matter what command I use, I want to pipe it in to another command. Specifically I want to pipe it to lolcat (which will just color everything in to a shade of rainbow). Is it possible to do this just by editing the .bashrc file? And, if anyone is wondering, I don't plan on actually using...
  4. E

    Running a script at startup

    I have a script to mount 2 network drives that work perfectly from the terminal using "sudo sh MntPD". This is the content of the MntPD file: #!/bin/bash sudo mount.cifs //10.0.0.2/drobo5n2/VideoMedia /media/plexdata -o vers=2.0,username=USERNAME,password=PASSWORD,noperm sudo mount.cifs...
  5. Tolkem

    Quickly add a new user to all groups the default user is in

    Hi everyone! Hope you're all having a nice life! :) So, I read this https://www.commandlinefu.com/commands/view/26031/quickly-add-a-new-user-to-all-groups-the-default-user-is-in and the code seems pretty simple, however, I do have one question $ awk -F: '/^.+user1/{print $1}' /etc/group | xargs...
  6. O

    Filesystem mounted by apache invisible to others

    For a Raspberry Pi application (https://github.com/outdoorbits/little-backup-box) I work on a web UI. This allows to mount USB-devices and perform backups. By the php-website a bash-script is triggered and this executes finally: sudo mount /dev/sda1 /media/storage/ -o umask=0 User www-data is...
  7. P

    Yanking and pasting from system's buffer within bash's vi mode

    I've recently switched to bash's vi mode after being reluctant and i'm currently facing two issues , namely not being able to use the system register for my cut,copy and pate operations with text between the command line and other applications . The only way to use the system register is while...
  8. cloudytechi147

    Linux sequence function isn't working properly in a bash script

    I'm working on a Linux course and using the best Linux OS, the instructor uses a ping-sweeping function as an example. It is meant to iterate through potential IPs on a network from 1 through 255 and return the ones that reply. The code is as follows #!/bin/bash for ip in 'seq 1 254'; do ping...
  9. M

    Date Formatting

    I've created a quick tutorial on some basic date formatting options in BASH. I hope you find this useful
  10. A

    bash detect file name and extension even there are numerous dots in the name?

    Hello, i have found following: n=${f%.*} # file name without extension e=${f#*.} # only extension, without dots f="abc.def.ghi jkl.tar.gz" && echo "${f%.*}_sample.${f#*.}" result is wrong: abc.def.ghi jkl.tar_sample.def.ghi jkl.tar.gz what is good, universal way to get the file name and the...
  11. SuperAdventureHunter

    Process Restriction in Debian

    Hi! I'm wondering how to restrict processes via command line in Debian, hence the title and subject. Though unconventional, I'm creating a script(s) for security purposes so any suggestions would be helpful. I'm looking to suspend, if not terminate any non-critical processes minus the terminal...
  12. M

    Log new directories (created in a certain place) in a file

    Hi all! I need to do the following: Monitor a certain directory (for example, /media/server/ ) for new directories being created. If a new directory is created, it should be written in a log file. The goal is to create a system (using cron), which periodically checks whether new directories...
  13. T

    How to define CROSSCOMPILER to get with $(CROSSCOMPILER)gcc my preferd gcc compiler

    Hello Community, i struggle with one problem for hours, however I decided to ask you for recommendation. The problem I have is that in one Makefile I found a command like $(CROSSCOMPILER)gcc which calls the gcc compiler from specific path. I thought that I just need to define CROSSCOMPILER as...
  14. S

    Debian 10, ChromeOS container: only topmost line of text changes when reverse scrolling in 'more'\'less' mode

    Specifically, I'm looking at a manual page for a command. After I scroll down through the manual, attempting to scroll back up results in only the topmost line of text in the terminal updating. Like, if I tap 'k' multiple times, the topmost line will change with each iteration of 'k', but all...
  15. Tolkem

    Can you give some ideas on how to improve script?

    Hi everyone! Hope you're all having a nice life! :) So, I took over practicing/learning bash scripting (once again :D). I'm not very good at it and my knowledge is very basic. Last year I wrote a script to practice the use of if statements if something_happens then do this else do this what...
  16. U

    Encountering IF statement and tee conflict in script

    Hi All I'm looking to be able to correctly evaluate my IF statement and also output what has been backed up into a log file. In the function at the bottom I am stuck between getting the IF statement to evaluate correctly and managing to log what has been backed up (synchronised with rsync)...
  17. P

    Bash: Determining if CANbus Bitrate is Configured Properly

    I'm working on an embedded Linux (4.1.15) bash script wherein the bitrate of a CANbus may be one of several possibilities. When my module comes online it comes up at the first bitrate in the list, checks for traffic, and, if no traffic, cycles through each bitrate in like manner until traffic is...
  18. L

    Need help with Bash

    Hello, Got a Bash Scripting issue. It has to be done with bash. I've been trying everything from SED to other tricks... Can't seem to get it right. I need to be able to replace a whole line with a random number and prefix in a text file. Example: ABCD123456 The letters are the preset prefix...
  19. C

    Alias not working in Bashrc that is a shell script

    Hi All, I've searched Google, and though I'm searching as to why my alias is not working in the bashrc, I'm getting results of alias not working in shell scripts. I have a script that is called digCUST.sh, and I added an alias in my .bashrc file: alias digh="digCUST.sh" I sourced the bashrc...
  20. blueray

    Text Above and Bellow Selected Lines

    I am using Geany. These is a option Edit > Format > Send Selected To > Set Custom Commands Here, for example if I want to sort selected text, I just use sort command. What I want this (Set Custom Commands) to do is put .... above and bellow my selected line/s. For Example if I select the...
Top