I was writing this code to organize my downloads folder so it wouldn’t be messy. i want the files to be moved to their proper folder like for mp4 it should go to the Videos folder. but the code is not working I guess it’s from ‘if’ statement but i don’t know how to fix it because i’m quite new
Tag: bash
Extract second word from a file in yum repository file using command line or bash
I wanted to extract a paticular file path from a text file (yum repository file) The file contents looks like this My requirement is to extract sslclinetkey path of both rhel-8-for-x86_64-appstream-rpm and rhel-8-for-x86_64-baseos-rpm through the command line or script Any help would be appreciated UPDATE I tried this way, but I am getting multiple entries But I only need of
Pipe into a shell/bash script from Web URL
How to download a script from URL, execute it, and pipe something into it – all with one command? I have a shell script to which I can pipe stuff: The script is moved to http://example.com/do-stuff.sh Try to do something like this: but it doesn’t work. Data does not get piped into the script. There is a workaround, but how
Command to list reordered ls columns works in terminal but not through running a script?
I’m trying to make a script that will print information of all files in a given directory in order of owner, group, filename, then permissions separated by commas. The code I wrote works fine when ran in terminal, but when I try to run it through a script with a directory given as $1, it only prints the owner name
what alternative methods for sudo echo without bash -c
I must run the echo in the script my.sh with sudo because permission. I do not want to execute the script with sudo my.sh. I do not want to use bash -c “…” because escaping. Are there no other solutions? my.sh Answer The problem you are encountering here is that the output redirection >/file.tmp has to happen with elevated privileges.
Operators and user input not found / unexpected while checking if users and groups exist in /etc/group and /etc/passwd
I can’t understand what’s wrong with my code. I’m trying to make it so that if the passed in username and group are both not found in /etc/group and etc/passwd echo both not found. If one but not the other is found echo one is found and finally if they are both found then echo both exist. Here is my
How can I combine the commands leave and say?
Is there a way to make use of the command leave and the command say (MacOS) to be notified by the built in voice system? I can do echo hello | say on the command line. leave outputs Time to leave! how can this output be piped to say once it appears? When I issue this command it’s just hanging.
Loopback/Echo bytes received over serial port
On an embedded Linux system running Busybox I am trying to receive bytes over a serial port and echo back everything received. The system setup is like this: Linux <-USB-> FTDI chip <-UART-> MCU On the UART line I have a logic analyser monitoring the data between the FTCI chip and the MCU. Both the MCU and Linux have the
Compare two text files line by line, finding differences but ignoring numerical values differences
I’m working on a bash script to compare two similar text files line by line and find the eventual differences between each line of the files, I should point the difference and tell in which line the difference is, but I should ignore the numerical values in this comparison. Example: In the example above, the script shouldn’t find any difference
How to convert a directory of XML files in to RRD Files
I need to restore rrd files from my exisiting xml files. So I have used following simple bash script. I could not execute following script due to this error, But I could restore files one by one. Can someone help me to solve this? Answer When you use: You will see that $i equals: /home/dump_xml/a.xml /home/dump_xml/b.xml You see, it contains