Struggling with a oneliner for disk usage
Hey All,
Hoping someone could help, So i have this oneliner which calculates disk space and gives a nice output in terms of largest directories and largest files, all you have to do is substitute in a dir path.
FS='/data';NUMRESULTS=20;resize;clear;date;df -h $FS; echo "Largest Directories:"; du -x $FS 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '{printf "%d MB %s\n", $1/1024,$2}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '{printf "%d MB\t%s\n", ($7/1024)/1024,$NF}'
I am looking to expand this to include where the most files originate as a whole count and then as a count in say the top 10 directories and provide this as a listing along with another expansion with also the number of inodes being used per directory.
​
Any help would be greatly appreciated.
https://redd.it/xoj51q
@r_bash
Hey All,
Hoping someone could help, So i have this oneliner which calculates disk space and gives a nice output in terms of largest directories and largest files, all you have to do is substitute in a dir path.
FS='/data';NUMRESULTS=20;resize;clear;date;df -h $FS; echo "Largest Directories:"; du -x $FS 2>/dev/null| sort -rnk1| head -n $NUMRESULTS| awk '{printf "%d MB %s\n", $1/1024,$2}';echo "Largest Files:"; nice -n 19 find $FS -mount -type f -ls 2>/dev/null| sort -rnk7| head -n $NUMRESULTS|awk '{printf "%d MB\t%s\n", ($7/1024)/1024,$NF}'
I am looking to expand this to include where the most files originate as a whole count and then as a count in say the top 10 directories and provide this as a listing along with another expansion with also the number of inodes being used per directory.
​
Any help would be greatly appreciated.
https://redd.it/xoj51q
@r_bash
reddit
Struggling with a oneliner for disk usage
Hey All, Hoping someone could help, So i have this oneliner which calculates disk space and gives a nice output in terms of largest directories...
Leading Characters In Auto-Generated Directory Names
I have a noscript that takes a large directory of files and moves those files into auto-numbered subdirectories, 1000 at a time. It works fine.
**My question is:** Now that I have over 100 sub-directories created when I do this, how do I add leading zeroes to one- and two-digit numbers? e.g., 001, 002, 012, 037, etc.
Existing noscript is below. Your expertise is most appreciated.
#!/bin/bash
# outnum generates the name of the output directory
outnum=1
# n is the number of files we have moved
n=0
# Go through all JPG files in the current directory
for f in *.jpg; do
# Create new output directory if first of new batch of 1000
if [ $n -eq 0 ]; then
outdir=$outnum
mkdir $outdir
((outnum++))
fi
# Move the file to the new subdirectory
mv "$f" "$outdir"
# Count how many we have moved to there
((n++))
# Start a new output directory if we have sent 1000
[ $n -eq 1000 ] && n=0
done
https://redd.it/xomgnz
@r_bash
I have a noscript that takes a large directory of files and moves those files into auto-numbered subdirectories, 1000 at a time. It works fine.
**My question is:** Now that I have over 100 sub-directories created when I do this, how do I add leading zeroes to one- and two-digit numbers? e.g., 001, 002, 012, 037, etc.
Existing noscript is below. Your expertise is most appreciated.
#!/bin/bash
# outnum generates the name of the output directory
outnum=1
# n is the number of files we have moved
n=0
# Go through all JPG files in the current directory
for f in *.jpg; do
# Create new output directory if first of new batch of 1000
if [ $n -eq 0 ]; then
outdir=$outnum
mkdir $outdir
((outnum++))
fi
# Move the file to the new subdirectory
mv "$f" "$outdir"
# Count how many we have moved to there
((n++))
# Start a new output directory if we have sent 1000
[ $n -eq 1000 ] && n=0
done
https://redd.it/xomgnz
@r_bash
reddit
Leading Characters In Auto-Generated Directory Names
I have a noscript that takes a large directory of files and moves those files into auto-numbered subdirectories, 1000 at a time. It works...
[Help] Parsing password to openssl OCSP
Hello everyone,
Hope everyone is doing great.
I'm implementing an OCSP server in my job and I ran into an issue.
While running \`openssl req/ca\` we can use the flag \`-passin\` or \`-passout\`, that flag doesn't exist in \`openssl ocsp\` version 1.1.1 only on version 3.
​
**Question is:**
Is there a way for me to parse the password via STDIN?
This is the command I'm trying to run:
openssl ocsp -index intermediate/index.txt -port 8080 -rsigner ${INTERMEDIATE_CRT_PATH} -rkey ${INTERMEDIATE_KEY_PATH} -CA ${INTERMEDIATE_CRT_PATH} -text
This will prompt:
Enter pass phrase for <cert_path>:
I have tried all the shell or bash magic I know and could find, tried getting the PID and redirecting to /proc/pid/fd/0 with no luck.
​
Any help would be appreciated. Thanks !
https://redd.it/xomaxz
@r_bash
Hello everyone,
Hope everyone is doing great.
I'm implementing an OCSP server in my job and I ran into an issue.
While running \`openssl req/ca\` we can use the flag \`-passin\` or \`-passout\`, that flag doesn't exist in \`openssl ocsp\` version 1.1.1 only on version 3.
​
**Question is:**
Is there a way for me to parse the password via STDIN?
This is the command I'm trying to run:
openssl ocsp -index intermediate/index.txt -port 8080 -rsigner ${INTERMEDIATE_CRT_PATH} -rkey ${INTERMEDIATE_KEY_PATH} -CA ${INTERMEDIATE_CRT_PATH} -text
This will prompt:
Enter pass phrase for <cert_path>:
I have tried all the shell or bash magic I know and could find, tried getting the PID and redirecting to /proc/pid/fd/0 with no luck.
​
Any help would be appreciated. Thanks !
https://redd.it/xomaxz
@r_bash
reddit
[Help] Parsing password to openssl OCSP
Hello everyone, Hope everyone is doing great. I'm implementing an OCSP server in my job and I ran into an issue. While running \`openssl...
How to print to bad sector count when disk is inserted?
(using BASH version 5.1.16 on Ubuntu 22.04)
​
Hello,
I would like to see the bad sector count of a drive when it is attached to the computer (not mounted). For example, I can run:
sudo smartctl -a /dev/sdb | grep ReallocatedSectorCt
​
and the output I get is something like:
​
5 ReallocatedSectorCt 0x0033 154 154 140 Pre-fail Always - 386
​
When I hotswap a SATA drive, I would like the command run again and outputted to the display.
Any help would be appreicated
https://redd.it/xoqz7i
@r_bash
(using BASH version 5.1.16 on Ubuntu 22.04)
​
Hello,
I would like to see the bad sector count of a drive when it is attached to the computer (not mounted). For example, I can run:
sudo smartctl -a /dev/sdb | grep ReallocatedSectorCt
​
and the output I get is something like:
​
5 ReallocatedSectorCt 0x0033 154 154 140 Pre-fail Always - 386
​
When I hotswap a SATA drive, I would like the command run again and outputted to the display.
Any help would be appreicated
https://redd.it/xoqz7i
@r_bash
reddit
How to print to bad sector count when disk is inserted?
(using BASH version 5.1.16 on Ubuntu 22.04) Hello, I would like to see the bad sector count of a drive when it is attached to the...
Saving a folder path to a variable
Please excuse such simple question newbie to bash :)
Pretty much what the noscript saids.
Looking to store a folder path into a variable to be later used in the noscript.
The noscript asks a few questions and based on your answer, nmap runs a scan against a set of IPs from File A or File B and then save the output to a folder.
There will be multiple different scan in which the output file is name different but all save to the same folder.
I’ve tried a few different method and get stuck with its Outputting everything in the file (CAT) or tells me the individual IPs in the files “no such file or directory xx.xx.xx.xx”
Few things I’ve tired:
Results= $Path://home/kali/Desktop/Results
FileA= $Path://home/kali/Desktop/FileA.txt
This is met with “No such file or directory”
Or
FileB= cat /home/kali/Desktop/FileB.txt
Thank you for any input!
https://redd.it/xowj9l
@r_bash
Please excuse such simple question newbie to bash :)
Pretty much what the noscript saids.
Looking to store a folder path into a variable to be later used in the noscript.
The noscript asks a few questions and based on your answer, nmap runs a scan against a set of IPs from File A or File B and then save the output to a folder.
There will be multiple different scan in which the output file is name different but all save to the same folder.
I’ve tried a few different method and get stuck with its Outputting everything in the file (CAT) or tells me the individual IPs in the files “no such file or directory xx.xx.xx.xx”
Few things I’ve tired:
Results= $Path://home/kali/Desktop/Results
FileA= $Path://home/kali/Desktop/FileA.txt
This is met with “No such file or directory”
Or
FileB= cat /home/kali/Desktop/FileB.txt
Thank you for any input!
https://redd.it/xowj9l
@r_bash
reddit
Saving a folder path to a variable
Please excuse such simple question newbie to bash :) Pretty much what the noscript saids. Looking to store a folder path into a variable to be...
Running Multiple Python Scripts
I have multiple python noscripts that need to run, consecutively. I think the easiest way to implement this is using a cron job to run a bash noscript that runs the python noscripts one after another.
The python noscripts use argparse to take arguments from the cli and are reused in other places, so I'd like to be able to implement this without needing to change the python noscripts themselves.
Something like
#!/bin/bash
/venv/bin/python3 mynoscript.py somearg -u 'anotherarg' -p 'athirdarg'
/venv/bin/python3 mynoscript1.py somearg -u 'anotherarg' -p 'athirdarg'
https://redd.it/xpi4xs
@r_bash
I have multiple python noscripts that need to run, consecutively. I think the easiest way to implement this is using a cron job to run a bash noscript that runs the python noscripts one after another.
The python noscripts use argparse to take arguments from the cli and are reused in other places, so I'd like to be able to implement this without needing to change the python noscripts themselves.
Something like
#!/bin/bash
/venv/bin/python3 mynoscript.py somearg -u 'anotherarg' -p 'athirdarg'
/venv/bin/python3 mynoscript1.py somearg -u 'anotherarg' -p 'athirdarg'
https://redd.it/xpi4xs
@r_bash
reddit
Running Multiple Python Scripts
I have multiple python noscripts that need to run, consecutively. I think the easiest way to implement this is using a cron job to run a bash...
Bash-5.2 Release available
https://lists.gnu.org/archive/html/bash-announce/2022-09/msg00000.html
https://redd.it/xptnng
@r_bash
https://lists.gnu.org/archive/html/bash-announce/2022-09/msg00000.html
https://redd.it/xptnng
@r_bash
Creating a magic file.
Hello,
I look to create a magic file that can be used with the command
My solution has been:
My problem is that when I run the file, the output is incorrect and I don't know why or where my blunder is. The output is:
https://redd.it/xq5ur4
@r_bash
Hello,
I look to create a magic file that can be used with the command
fileto detect
Schooldata files.
Schooldata files always contain the string
SCHOOLat offset 0.
My solution has been:
1: 0 string SCHOOL School data
2: !:mime School
compile
My problem is that when I run the file, the output is incorrect and I don't know why or where my blunder is. The output is:
1: Warning: offset `�' invalid
could not find any valid magic files!
https://redd.it/xq5ur4
@r_bash
reddit
Creating a magic file.
Hello, I look to create a magic file that can be used with the command ```file``` to detect ```School``` data files. ```School``` data files...
Tmux Issues
So i have this command and when i launch it from tmux it executes more than 8 times. But on regular terminal screen it executes one time with no issues.
Basically what it does it monitors a file and if that file has changed it executes the program.
btcusd1.sh
And sends the data to Screen named minute.
So in tmux terminal i've tried.
bash -c 'inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do tmux send-keys -t minute /files/ifvalueminute/btcusd1.sh ENTER; sleep 2; /files/ifvalueminute/ifvaluebtcusdminute.sh; break; done' &
And
inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do $(tmux send-keys -t minute "/files/ifvalueminute/btcusd1.sh" ENTER; sleep 2; "/files/ifvalueminute/ifvaluebtcusdminute.sh"); done
This works with no issue in the regular terminal screen window. Not in tmux though
inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do /files/ifvalueminute/btcusd1.sh; done &
Help or guidence is appreciated.
https://redd.it/xqf0bu
@r_bash
So i have this command and when i launch it from tmux it executes more than 8 times. But on regular terminal screen it executes one time with no issues.
Basically what it does it monitors a file and if that file has changed it executes the program.
btcusd1.sh
And sends the data to Screen named minute.
So in tmux terminal i've tried.
bash -c 'inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do tmux send-keys -t minute /files/ifvalueminute/btcusd1.sh ENTER; sleep 2; /files/ifvalueminute/ifvaluebtcusdminute.sh; break; done' &
And
inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do $(tmux send-keys -t minute "/files/ifvalueminute/btcusd1.sh" ENTER; sleep 2; "/files/ifvalueminute/ifvaluebtcusdminute.sh"); done
This works with no issue in the regular terminal screen window. Not in tmux though
inotifywait -m -e modify /tmp/btcusd_min.txt | while read -r dir; do /files/ifvalueminute/btcusd1.sh; done &
Help or guidence is appreciated.
https://redd.it/xqf0bu
@r_bash
reddit
Tmux Issues
So i have this command and when i launch it from tmux it executes more than 8 times. But on regular terminal screen it executes one time with no...
Check if each row in a file exists in a set of files, and if it does, update the last column in the first file with a value from the set of files
Hello!
There is a file A.tsv, which has these columns:
a b c d
With certain values in those columns. What I want to do, is for all rows, check if a row in this file exists in around 50 or so files that fall in different locations. The columns that those 50 files have are:
a b c d e f g h (first 4 are the same as above)
I'm trying to do:
for file in /my/location/50/files
for each row in A.tsv
if row exists in file1
A.tsv$5=corresponding value in file1$g
A.tsv$6=value in file1$h
if row exists in file2
A.tsv$7=file2$g
A.tsv$8=file2$h
And so on. Hence, the columns in A.tsv in which the data has to be stored will be changing for each file
The final file format for A.tsv is:
a b c d file1$g file1$h file2$g file2$h file3$g file3$h
and so on.
Now, I'm not sure what the best way to go about it is, and I'm having trouble coding it. Any help would be appreciated
Thank you!
https://redd.it/xqkakr
@r_bash
Hello!
There is a file A.tsv, which has these columns:
a b c d
With certain values in those columns. What I want to do, is for all rows, check if a row in this file exists in around 50 or so files that fall in different locations. The columns that those 50 files have are:
a b c d e f g h (first 4 are the same as above)
I'm trying to do:
for file in /my/location/50/files
for each row in A.tsv
if row exists in file1
A.tsv$5=corresponding value in file1$g
A.tsv$6=value in file1$h
if row exists in file2
A.tsv$7=file2$g
A.tsv$8=file2$h
And so on. Hence, the columns in A.tsv in which the data has to be stored will be changing for each file
The final file format for A.tsv is:
a b c d file1$g file1$h file2$g file2$h file3$g file3$h
and so on.
Now, I'm not sure what the best way to go about it is, and I'm having trouble coding it. Any help would be appreciated
Thank you!
https://redd.it/xqkakr
@r_bash
reddit
Check if each row in a file exists in a set of files, and if it...
Hello! There is a file A.tsv, which has these columns: a b c d With certain values in those columns. What I want to do, is for all rows, check...
How to keep hold of another directory's path whilst using mv command?
Hi, I am getting used to bash but not there yet to be intermediate.
I would like to
Now I could manually just find the file path of the directory I would like to move this folder to, however I might not an easier way of doing this in bash. What would you suggest?
https://redd.it/xqs2bn
@r_bash
Hi, I am getting used to bash but not there yet to be intermediate.
I would like to
mv <my_folder> <destination> // #how do I find my destination file path whilst keeping this command alive? Use variables or am i missing something much simpler?Now I could manually just find the file path of the directory I would like to move this folder to, however I might not an easier way of doing this in bash. What would you suggest?
https://redd.it/xqs2bn
@r_bash
reddit
How to keep hold of another directory's path whilst using mv command?
Hi, I am getting used to bash but not there yet to be intermediate. I would like to `mv <my_folder> <destination> // #how do I find my...
One-liner Script Issue
Hello, this is my first post here. I have a question about noscripting, not specifically bash noscripting, but more general noscripting, which I hope is allowed here. I'm trying to get the api output using curl, but I need to read from a text file and pass it to the curl. Here's an example:
CURL command:
`d909afaec435463aa433899dc00111b4` is the ID of the message I want to retrieve and the result is as follows:
And I have a
Any suggestions or pointers on what's wrong with the above one-liner would be greatly appreciated. Thank you very much.
https://redd.it/xqzop5
@r_bash
Hello, this is my first post here. I have a question about noscripting, not specifically bash noscripting, but more general noscripting, which I hope is allowed here. I'm trying to get the api output using curl, but I need to read from a text file and pass it to the curl. Here's an example:
CURL command:
curl --location --request GET '`https://conversations.messages.com/v1/messages/d909afaec435463aa433899dc00111b4`' --header 'Authorization: AccessKey 123AbcDefgh456' | python3 -mjson.tool`d909afaec435463aa433899dc00111b4` is the ID of the message I want to retrieve and the result is as follows:
{"id": "d909afaec435463aa433899dc00111b4","name": "Alex Baldwin",}And I have a
msg.csv file with, say, 1,000 message IDs that I want to pass to curl. Here is my one-liner and the result.$ cat msg.csv | while read line; do curl --location --request GET '`https://conversations.messages.com/v1/messages/$line`' --header 'Authorization: AccessKey 123AbcDefgh456' | python3 -mjson.tool; done{"errors":[{"code":20,"denoscription":"Message not found"}]}Any suggestions or pointers on what's wrong with the above one-liner would be greatly appreciated. Thank you very much.
https://redd.it/xqzop5
@r_bash
how to share a variable between function calls
hi guys, hope you all doing well. i have two functions
those look like this
f1 () {
var=0
f2 &
echo $var # prints 0
}
f2 () {
var=1
sleep 10
echo $var # prints 1
}
I want the
the background (or at least have the
https://redd.it/xr212s
@r_bash
hi guys, hope you all doing well. i have two functions
f1 and f2 those look like this
f1 () {
var=0
f2 &
echo $var # prints 0
}
f2 () {
var=1
sleep 10
echo $var # prints 1
}
I want the
echo in f1 to notice the change in the $var how can i do this while having f2 run in the background (or at least have the
sleep function run in the background while f1 continues running )https://redd.it/xr212s
@r_bash
reddit
how to share a variable between function calls
hi guys, hope you all doing well. i have two functions `f1` and `f2` those look like this f1 () { var=0 f2 & echo...
Examples of cool || non-standard || "simply insane" bash stuff?
Hi guys.
So recently I encountered following project: https://github.com/Jack000/Expose
Basically, it is bash noscript which makes sort of photo-based static blog/site. Got me curious about shell noscripting in general (although I am Linux user little less than 2 decades), because most of my "shell" noscripts are actually written in Ruby.
Do you have other examples where size or purpose of Bash/shell project is unusual or non-standard? Simply something where "sane" people would use a general dynamic programming language?
Also, I found out that Chet Ramey is sole maintainer. Anyone knows what he uses to develop bash? I assume it is not Mac. :P
Thank you.
https://redd.it/xr1vce
@r_bash
Hi guys.
So recently I encountered following project: https://github.com/Jack000/Expose
Basically, it is bash noscript which makes sort of photo-based static blog/site. Got me curious about shell noscripting in general (although I am Linux user little less than 2 decades), because most of my "shell" noscripts are actually written in Ruby.
Do you have other examples where size or purpose of Bash/shell project is unusual or non-standard? Simply something where "sane" people would use a general dynamic programming language?
Also, I found out that Chet Ramey is sole maintainer. Anyone knows what he uses to develop bash? I assume it is not Mac. :P
Thank you.
https://redd.it/xr1vce
@r_bash
GitHub
GitHub - Jack000/Expose: A simple static site generator for photoessays
A simple static site generator for photoessays. Contribute to Jack000/Expose development by creating an account on GitHub.
Viewing rows based on condition with awk ?
Hi,
I'm getting disk information using
Filesystem Size Used Avail Use% Mounted on
devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 818M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 4.0G 2.6G 1.5G 64% /
/dev/sda2 4.0G 33M 4.0G 1% /media/sda2
/dev/sda5 509M 26M 483M 6% /media/sda5
/dev/sda6 18G 5.6G 12G 33% /media/sda6
/dev/sda3 4.0G 33M 4.0G 1% /media/sda3
tmpfs 1.6G 0 1.6G 0% /run/user/0
But I only want to see rows with storage space 30% or more used. How can I add condition to awk to get this information along with Headers
Expected Output
Filesystem Use%
/dev/sda1 64%
/dev/sda6 33%
How can I achieve this.
I have this so far but no header noscripts
df -kh | awk 'FNR == 6 {print $1" "$5}'
/dev/sda1 64%
Thank You
https://redd.it/xr1925
@r_bash
Hi,
I'm getting disk information using
df -khFilesystem Size Used Avail Use% Mounted on
devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 818M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/sda1 4.0G 2.6G 1.5G 64% /
/dev/sda2 4.0G 33M 4.0G 1% /media/sda2
/dev/sda5 509M 26M 483M 6% /media/sda5
/dev/sda6 18G 5.6G 12G 33% /media/sda6
/dev/sda3 4.0G 33M 4.0G 1% /media/sda3
tmpfs 1.6G 0 1.6G 0% /run/user/0
But I only want to see rows with storage space 30% or more used. How can I add condition to awk to get this information along with Headers
Expected Output
Filesystem Use%
/dev/sda1 64%
/dev/sda6 33%
How can I achieve this.
I have this so far but no header noscripts
df -kh | awk 'FNR == 6 {print $1" "$5}'
/dev/sda1 64%
Thank You
https://redd.it/xr1925
@r_bash
reddit
Viewing rows based on condition with awk ?
Hi, I'm getting disk information using `df -kh` Filesystem Size Used Avail Use% Mounted on devtmpfs 5.7G 0 5.7G 0%...
Different Oout of same Script ?
Hi,
I have the following noscript:
# Text Color
RED='\0330;31m'
BLUE='\033[0;34m'
NC='\033[0m'
if [ $reqSpace -lt $availableSpace
then
echo -e "${BLUE}Backup Possible, Log Data size $result MB, Free Space $availableSpace MB${NC}"
else
echo -e "${RED}Backup Not Possible, Log Data size $result MB, Free Space $availableSpace MB${NC}"
fi
This noscript when run once shows as expected result
https://preview.redd.it/p5ks73exgtq91.jpg?width=697&format=pjpg&auto=webp&s=649e36d797013fdf319c49319d58f0cf1eabe974
But when run with
https://preview.redd.it/ukm9f2d2htq91.jpg?width=701&format=pjpg&auto=webp&s=c83a7ae79f05902b3507725b6f9e259290f87de8
Any idea what's going on ?
https://redd.it/xravbu
@r_bash
Hi,
I have the following noscript:
# Text Color
RED='\0330;31m'
BLUE='\033[0;34m'
NC='\033[0m'
if [ $reqSpace -lt $availableSpace
then
echo -e "${BLUE}Backup Possible, Log Data size $result MB, Free Space $availableSpace MB${NC}"
else
echo -e "${RED}Backup Not Possible, Log Data size $result MB, Free Space $availableSpace MB${NC}"
fi
This noscript when run once shows as expected result
https://preview.redd.it/p5ks73exgtq91.jpg?width=697&format=pjpg&auto=webp&s=649e36d797013fdf319c49319d58f0cf1eabe974
But when run with
watch command does not parse the color variables.https://preview.redd.it/ukm9f2d2htq91.jpg?width=701&format=pjpg&auto=webp&s=c83a7ae79f05902b3507725b6f9e259290f87de8
Any idea what's going on ?
https://redd.it/xravbu
@r_bash
Printing out command to terminal but not executing
Hi everyone. How do you print out a command to terminal without executing it in bash? For example, fzf's CTRL-R command will print it out to terminal before executing. How does one do that for arbitrary command?
https://redd.it/xrjtxf
@r_bash
Hi everyone. How do you print out a command to terminal without executing it in bash? For example, fzf's CTRL-R command will print it out to terminal before executing. How does one do that for arbitrary command?
https://redd.it/xrjtxf
@r_bash
reddit
Printing out command to terminal but not executing
Hi everyone. How do you print out a command to terminal without executing it in bash? For example, fzf's CTRL-R command will print it out to...
exiftools, bad substitution error when trying to modify Content Create Date metadata
I used this command last year to remove the timezone from the "Content Create Date" field in a MP4 file. But now when I run this command, I get the following error...
$ exiftool -overwrite_original "-ContentCreateDate#<${ContentCreateDate; s/[+-].*//}" "file.mp4"
bash: -ContentCreateDate#<${ContentCreateDate; s/[+-].*//}: bad substitution
Not sure why this is the case now. Is there a way to get around this? Thanks in advanced.
https://redd.it/xrpux1
@r_bash
I used this command last year to remove the timezone from the "Content Create Date" field in a MP4 file. But now when I run this command, I get the following error...
$ exiftool -overwrite_original "-ContentCreateDate#<${ContentCreateDate; s/[+-].*//}" "file.mp4"
bash: -ContentCreateDate#<${ContentCreateDate; s/[+-].*//}: bad substitution
Not sure why this is the case now. Is there a way to get around this? Thanks in advanced.
https://redd.it/xrpux1
@r_bash
reddit
exiftools, bad substitution error when trying to modify Content...
I used this command last year to remove the timezone from the "Content Create Date" field in a MP4 file. But now when I run this command, I get...
How to redirect stdin from an Interactive program to a File
I'm hoping to redirect the inpit of the python repl to a file
For example; would it be possible to set
my first attempt was doing
and then
The issue there is it's grabbing only the output from the repl and the output of the interpreter, now the i/o stream of reading the commands.
Any ideas are welcome..
https://redd.it/xrsdjv
@r_bash
I'm hoping to redirect the inpit of the python repl to a file
For example; would it be possible to set
exec 3>&1 file denoscriptor somehow pipe stdin from the python repl to stdout into a log file?my first attempt was doing
exec 3>&1and then
python 2>&1 | >&3 tee -a SomeFile.logThe issue there is it's grabbing only the output from the repl and the output of the interpreter, now the i/o stream of reading the commands.
Any ideas are welcome..
https://redd.it/xrsdjv
@r_bash
reddit
How to redirect stdin from an Interactive program to a File
I'm hoping to redirect the inpit of the python repl to a file For example; would it be possible to set `exec 3>&1` file denoscriptor somehow pipe...
Whiptail --menu help
​
Can someone explain what ' 3\>&1 1\>&2 2\>&3 ' means
https://redd.it/xrzvxt
@r_bash
​
Can someone explain what ' 3\>&1 1\>&2 2\>&3 ' means
https://redd.it/xrzvxt
@r_bash
FuzzyFind with Array
### I want to pipe the content of a directory(both files and directories) to fzf
this is my attempt so far. it's not functional
### the expected output:
fzf the content of the specified directory
### the current ouput:
fzf the content of the current directory===>$PWD
Thx in advance
https://redd.it/xs1egg
@r_bash
### I want to pipe the content of a directory(both files and directories) to fzf
this is my attempt so far. it's not functional
#!/usr/bin/env bash
content_dir="$HOME/DevRepo"
### this is my array
arr=$(ls "$content_dir")
fzf --preview "printf '%s\n' \"\${arr[{n}]}\""
### the expected output:
fzf the content of the specified directory
### the current ouput:
fzf the content of the current directory===>$PWD
Thx in advance
https://redd.it/xs1egg
@r_bash
reddit
FuzzyFind with Array
### I want to pipe the content of a directory(both files and directories) to fzf this is my attempt so far. it's not functional...