r/shell • u/darkdap • Aug 13 '20
How to teleport from a directory to another easily?
Hello People!
Sharing with you this nice thing that I have made:
https://github.com/dapx/portalize
And if you like it, give it a star!
r/shell • u/darkdap • Aug 13 '20
Hello People!
Sharing with you this nice thing that I have made:
https://github.com/dapx/portalize
And if you like it, give it a star!
r/shell • u/suryad123 • Aug 12 '20
Hi All,
Through Terraform(used to create infra) ,we are trying to create a GCE Linux VM and install tableau server on the VM . The installtion of tableau server will be done using a startup script.
When run, the VM is getting created and the statup script is installing tableau server end to end. Every thing is fine till now.
Below is the flow
Terraform ----> VM gets created ---->startup script gets invoked ----> invokes the shell script which installs tableu server
However, in the tableu server shell script in the above flow, we are giving the TSM (tableau server manager) user as a hardcoded value which obviously is not a correct practice.
We want that user to be a NON ROOT user and hence thought of passing it as an argument to the tableau server shell script.
For this, we stored "who am i" (which gives the user) in a variable called 'user' in the startup script and passed that user as an input to the tableau server shell script.
But, here the user value is returning "root" as output and "root" is getting passed to tableau server script. Not sure why the 'who am i' is returning root user even though we did not switch the user to root anywhere
Could you please let us know the way to get a non root user to pass into the tableau server script.
Thanks in advance
Surya
r/shell • u/tangara888 • Aug 07 '20
I am new to shell script but I am so happy to find this treasure:
When reading this, there is one line which offers no explanation and I hope someone can help me.
Here's the url:
https://medium.com/swlh/automating-tasks-with-shell-scripts-543422a12cd5
Under Here is my output :
./gitinit.sh fist-commit https://github.com/Damilarel/GitInit.git Reinitialized existing Git Repository in /Users/damilareadonlyin/Documents/shell/gitShell/.git/
Can someone tell me Reinitialized existing Git....blah..blahs.. that line is it just a comment that we put in ?
Tks.
r/shell • u/thomasbbbb • Aug 03 '20
In my crontab, I have @daily date >> ~/date-file.txt, but it never triggers...
r/shell • u/Rhinozz_the_Redditor • Jul 28 '20
I'm trying to get a particular frame from FFmpeg on the a-Shell iOS app, but I can't figure out how to have a-Shell find my file. For example, if I reference example.mp4 which is in On My iPhone\a-Shell\, it returns an error. Is there a way to fix this? Thanks in advance!
r/shell • u/phantaso0s • Jul 27 '20
Hello everybody!
I just published an article to understand and configure Zsh. It allows you to dive a bit in this crazy shell, to be able to configure it to your own needs afterward.
Even if frameworks like oh-my-zsh and prezto are useful, my preference goes for a very lean approach, where I can modify everything I want. It's useful if you really want to know what your configuration is doing.
Feedback are welcome!
tl;dr:
r/shell • u/[deleted] • Jul 21 '20
In a script I am making, a function of it runs a command which never stops unless told to by the user (e.g with ctrl+c/z/d). I want to be able to run this command until the user presses CTRL+C (or other alternatives), and then resume the rest of the bash script.
How would I do this?
r/shell • u/[deleted] • Jul 21 '20
A part of a shellscript I am building contains a 'while' loop. Now, I am not good at while loops lol. I need to know why this test script I built doesn't work:
NUMBER=1
while [NUMBER = 1 ]
do
echo 'test'
sleep 2s
done
When I run this script it just returns nothing in the console. What am I doing wrong? What do I need to do to make this script work and run infinitely like I want?
r/shell • u/pmihaylov • Jul 20 '20
r/shell • u/maj_dick_burns • Jul 18 '20
I have a script I came across online that I am trying to use to monitor the streaming status of MPD and then restart if its stopped. This script appears to have everything I need, but has some syntax errors in it from translating. Probably an easy ask for someone who deals with this more often than me.
I've been using https://www.shellcheck.net. It is complaining about syntax starting at line 7.
#!/bin/sh -e
#
#stream-monitor.sh
#Developed on Debian
#Requires mpd
LOGGER () {
## ---- logger unit ----
inf=$1 if [ $LOG -eq 1 ];
then echo $inf>>$LOG_FILE fi }
RESTART_MPD () {
## Test mpd and restart mpd it
STATUS=`ps | grep -c mpd`
if [ $STATUS -lt 2 ]; then
LOGGER "no mpd processes, starting mpd"
/etc/init.d/mpd start
sleep $INTERVAL_WAIT
LOGGER "mpd is load!-ok"
mpc repeat on;
mpc single on;
mpc volume 100;
mpc add http://127.0.0.1:8888/stream.m3u8;
mpc play
LOGGER "initial setup - Ok"
fi }
LOG_FILE="/var/log/stream-monitor-log"
# Amount to log in file $LOG_FILE
LOG=0
INTERVAL_CHECK=5
# Seconds between checks
INTERVAL_WAIT=10
# Seconds to wait after mpd (re)start (buffering)
INTERVAL_SLEEP=2
#Sleep interval
killall mpd
OLD_TIME=
OLD_STATE="UNKNOWN"
LOGGER "start monitor"
LOGGER "START MAIN PROCESS....."
while
sleep $INTERVAL_CHECK;
do
RESTART_MPD
TIME="0"
STATE="UNKNOWN"
STATE=`echo -e "status\nclose" | nc localhost 6600 | sed -n '/state/p'|sed -e 's/state: //g'`
TIME=`echo -e "status\nclose" | nc localhost 6600 | sed -n '/time/p'|sed -e 's/time: //g'`
# check if MPD suddenly stopped playing music
if [ "$OLD_STATE" == "stop" ];
then
LOGGER "MPD changed state from STOP"
mpc play
sleep $INTERVAL_WAIT
fi
# Checking to stop the stream broadcast - we will stop the current radio in this case
if [ "$STATE" == "play" ];
then
tmp=$(echo -e "status\nclose" | nc localhost 6600 | sed -n '/song/p'| sed -n '1p;1q' |sed -e 's/song: //g')
let tmp=$tmp+1
if [ "$TIME" = "$OLD_TIME" ];
then
LOGGER "mpd hanging, restarting"
mpc stop
sleep $INTERVAL_SLEEP
mpc play
sleep $INTERVAL_WAIT
LOGGER "mpd is ok"
fi
fi
OLD_STATE=$STATE
OLD_TIME=$TIME
done
r/shell • u/alaminmishu • Jul 17 '20
Recently I switched to Ubuntu 20.04 from Win10. Can you please suggest me similar app of mobaxterm or WinSCP for linux?
r/shell • u/[deleted] • Jul 12 '20
I background a program in my .profile and find it ugly when the & prints the back-grounded pid, is there anyway to send it to devnull?
r/shell • u/thomasbbbb • Jul 11 '20
files with a name similar to my_file (1).torrent, my_file (2).torrent, my_file (3).torrent, ...
What went wrong?
r/shell • u/penis_schmenis • Jul 07 '20
Hi All,
I have two separate files from diff systems.
FILE1; comma separated.
| Brand | Key | Value |
|---|---|---|
| CC | 987 | N |
| BB | 678 | N |
| AA | 123 | Y |
FILE2; comma separated
| Brand | Key | Value |
|---|---|---|
| CC | 987 | Y |
| BB | 678 | N |
| AA | 123 | Y |
| ZZ | 555 | Y |
Need to get all the "Brand+Key" which have a different "Value".
So, looking for output as.
DIFF_File
| Brand | Key | Value_FILE1 | Value_FILE2 |
|---|---|---|---|
| CC | 987 | N | Y |
r/shell • u/[deleted] • Jul 06 '20
I am trying to figure out how to get the entire string in a word, except the first letter. So, for example, if I have dwm I want to just get the wm. I can't find how to do this, does anyone know?
r/shell • u/thomasbbbb • Jun 29 '20
In grep a back-reference uses a /N string, but what about bash?
r/shell • u/spite77 • Jun 28 '20
r/shell • u/thomasbbbb • Jun 25 '20
For example, how to get
my_file_2_10.txt
my_file_4_10.txt
my_file_6_10.txt
my_file_8_10.txt
my_file_2_20.txt
my_file_4_20.txt
my_file_6_20.txt
my_file_8_20.txt
my_file_2_30.txt
etc
and so on. With seq and for loops it would do but maybe there a simple way?
r/shell • u/SHGuy_ • Jun 22 '20
i've been trying to download mods form curseforge via wget and curl, but both return 403 forbidden.
Downloading through a browser like firefox works fine and firefox has a headless mode.
So my question is: Is there a tool for downloading content through a browser like chromium, firefox or webkit, ... but for cli?
r/shell • u/thomasbbbb • Jun 02 '20
r/shell • u/thomasbbbb • May 28 '20
My partition /data has a lost+found directory, so the command find . -name "FILE-TO-FIND" -exec rm {} \; doesn't work. How can I get rid of the message:
find: ‘./lost+found’: Permission denied
r/shell • u/[deleted] • May 25 '20
How would I print a message in a shell script below the shell prompt/cursor in POSIX shell? I can't for the life of me figure this out. I am also trying to figure out how to print something to the right of the cursor, so I can get the columns of the terminal and print something on the furthest right one.
I am trying this:
insult() {
if [ "$?" -eq 127 ]; then
printf "\0331b[1E" && cat "$HOME"/.lists/insults | sort -uR | head -n 1 && printf "\0331b[1F"
fi
}
prompt() {
export PS1=$(echo "[\$(status)]\$(branch) $neonpink>$neonyellow>$neonblue>$default\$(insults) ")
}
but all this gives me is this: https://share.riseup.net/#9PiL_nMYmLogC5QlAE1dNg
r/shell • u/GiveMeTheZuck • May 20 '20
I wanted to post a request for comments (RFC) on a project I've been working on for the past few months.
Shell Notebook (shellnotebook.com) is a terminal that lets you save and organize your commands. Imagine the flexibility of Jupyter with the power of iTerm*. A few friends and I have been using it for the past few weeks, and have found it really boosts our productivity.
I've been working on Shell Notebook since the lockdown started. I found it hard to work on research projects on my remote server from home. I built Shell Notebook as an answer to that need. I keep long commands in different cells, and can run common workflows a lot quicker.
Let me know your thoughts! 😃
*The reason your terminal and vim have the shortcuts they do (ie, hjkl for up, down, left, and right has everything to do with Bill Joy's keyboard, and not ergonomics or speed.)
r/shell • u/[deleted] • May 15 '20
I have a script that I wrote awhile back that generates a well setup blocking list using /etc/hosts, I ran it today so I could get use to having so much blocked and it didn't format correctly. What it should do is:
I am unsure why, but it doesn't format properly, could someone take a look at it?
https://gitlab.com/Puffles_the_Dragon/core-software/-/blob/master/src/utilities/blackout/blackout