Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

2
votes
1answer
713 views

Unable to Create Files In Directory

There are lot of these kinds of questions on superuser, so I'll try and keep this quick by telling you what it's not: There is no application involved here. Just a user and a filesystem. I can login ...
1
vote
1answer
27 views

Bash Script, Striping out newline characters in variable

Still getting the hang of bash scripting... I have a function that resizes images and calculates how much to scale it based on the file size. I need to pass this percentage as an argument to the ...
1
vote
1answer
35 views

using trap to close one program when another is closed

Ok...here's my goal....I use dwm, so normally I have no need for a compositing manager. That being said, there are times when I would like to have it running temporarily. There are times when I want ...
1
vote
1answer
101 views

How to daemonize a bash script only if --daemon flag is given?

I have my script.sh and want to run it with ./script.sh or ./script.sh --daemon, having it remain in the foreground unless the --daemon flag is given, in which case it should detach and go into the ...
1
vote
1answer
116 views

Directory auto completion in bash scripts

Bash scripting newbie here writing my first script to copy a directory of pictures from one place to another. #!/bin/bash # Moves picture directories cp -R /path/to/pictures/$1 ...
1
vote
1answer
189 views

Find last 24 hours executed commands per each user in bash

How can I find last 24 hours executed commands per each user and mail them the result? I have Ubuntu GNU/Linux. I find out that I need a package named 'acct'. I have already installed and enabled that ...
1
vote
1answer
1k views

Postgresql query within a bash script

We are having an issue with a postgresql bash query. The output of the query from the bash script add's additional quotes around the date. Please can you help me fix it?! Script: #!/bin/sh ...
1
vote
1answer
51 views

UNIX Scripting Possibilities

Need a small help to understand if a task can be accomplished using UNIX script. Situation: Symantec Endpoint Encryption when installed on Mac, a manual intervention is required where a technician ...
1
vote
1answer
860 views

BASH: How to best filter directories of files for a certain date range in the filename?

Here's the picture... Date format: Y%m%d%H%M%S% This is my filename format: file_sub1_20110501000000.txt Directory structure: dir/ sub1/ file_sub1_20110501003000.txt ...
0
votes
1answer
22 views

What is the difference between \e[38;5;175m and \[\e[38;5;175m\] as it relates to bash colors?

I have been trying to learn how to customize my shell and I came across two different ways of specifying colors in the Bash shell. They both seem to accomplish the same goal and I am not sure what (if ...
0
votes
1answer
29 views

How to pipe binary stdout to a compressed tls connection?

Not so long ago, I could use : cat somefile.txt | openssl s_client -connect server:port -quiet -comp However, this command doesn’t work, even with-ign_eof: $ cat somefile.bmp | openssl s_client ...
0
votes
1answer
10 views

lost virtualenv display to the left of bash prompt

I added thy Holy prompt to display my current branch so I never push to master. We all use it and it works, but I am no-longer seeing what virtualenv I'm using at the moment, which is a hassle. Based ...
0
votes
1answer
41 views

Dictionary attack in Bash with cURL

I'm fairly new to Bash, but this is a script I've been working on for the past few days. It's meant to run a dictionary attack on an HTTP-POST login for a website, by reading the time module and ...
0
votes
1answer
50 views

Bash loop for adding --exclude list to tar

I have a bash script I made to encrypt/decrypt using GPG and tar. Right now I have my --exclude hard coded into the script, but I'd like to make it a bit more dynamic and add the items to exclude as ...
0
votes
1answer
19 views

Can I set a process name for my tomcats on CentOS ?

I have several tomcats running on my centos. If I try "top", all of them are shown as "java" . Is there anyway, such as changing the catalin.sh, that I can make each of the tomcat has its own name ...
0
votes
1answer
28 views

My bash script's if / then check is always evaluating to true

I was trying to write a bash script to handle a conditional switch, and it kept evaluating to true every time. So, I stripped it down to this, and I was getting the same behavior of it always echoing ...
0
votes
1answer
21 views

Tar compress directories and contents into individual, dated files based on folder name bash script

This is on a Debian system. I have had the compression of files and contents into individual folders working fine but not with the date added to the file names. Removing the date part, it works as it ...
0
votes
1answer
36 views

In Bash, can I have autocd open an editor if I enter a filename?

I’ve just set autocd in my .bash_profile: shopt -s autocd Now I can just type $ some-directory and automatically cd into it. Now, can I somehow tell Bash that if I enter not just a directory ...
0
votes
1answer
136 views

%T specifier in printf option of `stat` command

I want to know what is %T specifier in stat printf option and how it gets the file descriptor value ie., fd,1 is printed by using the below command. command is $> echo `stat -L ...
0
votes
1answer
198 views

Deleting oldest files to free space as needed on Linux

I have a cron job that writes logs to /tmp. I want to automatically delete the oldest files when the free space in the disk becomes less than 1GB. I'm trying to do df -ah /tmp, then take the 2nd ...
1
vote
0answers
23 views

How to find processes which uses the most RAM in last X seconds?

Could you please help me to sort this out? I'm trying to write a bash script which will monitor ram usage (not only ram but cpu and network as well) and show me 3 processes which use the most ram in ...
1
vote
0answers
41 views

Linux: Finding Processes I Started To Kill Them

I am programmatically starting several servers in Gnome terminal with each server in its own titled tab: gnome-terminal \ --tab -t "Server1" -e 'bash -c "export ...
1
vote
0answers
204 views

Rsync do not do anything if files not changed

#!/bin/sh date=`date "+%Y-%m-%dT%H:%M:%S"` rsync -aP --link-dest=/target/current '/source/folder' /target/back-$date rm -f /target/Backups/current ln -s back-$date /target/current This is a little ...
1
vote
0answers
11k views

how to get flash video stream URL from website without browser (telediario, rtve)

I want to access the video stream URL of telediario from spanish television (RTVE) which you can find here in a flash player: http://www.rtve.es/alacarta/videos/telediario/ I want to do this with ...
0
votes
0answers
12 views

Bash completion: filter out backup (~) files

I would like bash to filter out backup files, with a name ending in ~ (tilde), when auto-completing filenames. I have written a script to set this when using vim (I have very little experience with ...
0
votes
0answers
19 views

Lua variable as a shell command

Hii aLL Im using Awesome Wm and i want to set a shell command as a variable on my rc.lua i look in Internet and i found this : SHell Command : $ ip link | grep "[1-9] :en" | cut -d ":" -f2 | awk ...
0
votes
0answers
3 views

Is it possible to download the document from a typo3 CMS?

I have access to a typo3 CMS. The CMS displays documents in a viewer with tiled images at several zoom levels. The CMS also allows a download via a munged up PDF. By this I mean what is visible in ...
0
votes
0answers
19 views

calculate avg time for 3 person time in linux

how can i show 3 person's average sum in linux? For example, let the times for dough be 1,2,3,4,5 seconds delta be 5,6,7,8,9 amanada be 7,4,5,6,7 in bash script for all 3 users
0
votes
0answers
37 views

Need help on how to create a Youtube Automatic Artist Discography List Generator and use this bash script to play it

Example: #FrankSinatra <-- based on youtube automatic generator "Top Tracks", then passing that list to this bash script player (listed below) randomly or not, could also accept more artists, ...
0
votes
0answers
9 views

Variable from dialog box input doesn't behave as expected

I have a variable which the user sets by selecting from a dialog list. The variable is later used to cd. The variables are subdirectories in the format "sub.domain.tld." Import options array m here ...
0
votes
0answers
17 views

TFTP error code returned in bash

I have the below code to check on tftp error in my bash script. # fetch images from tftp server tftp_fetch() { echo "Fetching via tftp: $1:$tftp_path/$2" if ! tftp -g $IPADDR -r ...
0
votes
0answers
16 views

Stop bash script with any key

I'm writing a script which I want to stop with any key I choose. After pressing the key, my intention is to complete all my commands at that moment and start su. I've tried adding a & to my ...
0
votes
0answers
23 views

Add remmina rdp connection entry on many computers

i want to add remmina rdp connection entry on many computers (~200). I know that the remmina keeps every connection entry in single file in ~/.remmina, so i wanted to write script that will copy this ...
0
votes
0answers
61 views

Can the wmic command reliably be used in script batch files?

I believe that the following command: wmic product where "name like '%%winzip%%'" call Uninstall shuts down PC's when deployed with SCCM. Has anybody came across any issues with the command similar ...
0
votes
0answers
36 views

How can I process traffic between 2 instances of NetCat?

I have an utility that make some data transformation between stdin and stdout in both directions (encode / decode), and I want to make a some kind of bi-directional proxy using two nc instances and ...
0
votes
0answers
22 views

How to have bash script run a bash command with

I am trying to have a bash shell in my desktop so that when I ssh to the server I can just run the command and have the script to open three terminal and have them cd in to a path and run another ...
0
votes
0answers
92 views

How to receive sse (server sent events) and execute bash commands then

How do i receive server sent events (sse) from a webserver and execute a bash command with the received data in debian (raspbian)? Is that possible with curl as i can already receive sse. Thanks ...
0
votes
0answers
168 views

How to transcode a video to XviD format with GStreamer?

I'm trying to script a GStreamer pipeline to transcode videos to my Meizu M6 miniplayer. I found some scripts to do the transcoding with mencoder, but would like to do that with GStreamer. The device ...
0
votes
0answers
743 views

unexpected EOF while looking for matching `"'

JACOB=192.168.1.66 ZAC=192.168.1.65 echo "Type someone's name, or type ? to list options." read OPTNAME if [ $OPTNAME = "?" ]; then echo "Jacob's Computer: Type 'JACOB'" echo "Zac's ...
0
votes
0answers
54 views

Spawn new consoles from script and get back to the main console instance

The goal is to use a script to launch and execute a command in n separate window terminal: (I use lxterminal) It works when I copy/pase the following block of commands, It executes each lines ...
0
votes
0answers
198 views

how to grep exact pattern

I’ve tried several grep / egrep ideas with different options but none worked here. I’m trying to grep exact match of the pattern I’m looking in a log. For example I want only a pattern “ERROR” to get ...
0
votes
0answers
70 views

Bash Script - Find “ERROR” and output to file

I'm writing my first bash script and could use some help / advice. I cannot test the script at the moment - just want to know if I have it setup correctly. I have a file $A_HOME/bin/nohup.out and I'm ...
0
votes
0answers
30 views

Security Monitoring Using last Command

I am new to linux administration and was looking for a good way to get e-mail alerts when a user logs in. I was thinking this might be useful as a security monitoring tool to allow me to see who is on ...
0
votes
0answers
149 views

OSX Convert and Network User to Mobile User or force all Network Users to Mobile

We have Macs that I am working on binding to LDAP (not AD) and I want to make sure when a user logs in using their ldap credentials that it either create them a Mobile Account or it runs a script to ...
0
votes
0answers
24 views

Can I Query a Pdf Reader If It's On The Last Page?

I'm writing a wrapper shell-script to do the following: Searches a directory for .pdf/.djv files. makes an ordered "playlist" of files Opens 1st file in a pdf reader. Automatically change to the ...
0
votes
0answers
85 views

binary substitution in (audio)streams with bbe or sed

I try to do some stream manipulation with webradio streams. Goal is to use a pattern in triggerfile to substitute some seconds of the instream to silence in the outstream I found bbe to possibly fit ...
0
votes
0answers
90 views

Autoexport bash internal variables

I need to access to some bash internal variables (BASH_LINENO, BASH_SOURCE) from a command invoked by a shell script. The only possible interface between my command and the script are environment ...
0
votes
0answers
55 views

Rsync delete issue

I implemented rsync to backup the data from the server to my local machine,and done it regularly by cron. It works fine but yesterday it deletes the files from the folders on my local machine but on ...
0
votes
0answers
164 views

gnome-terminal flag sh

I'm extremely new to linux, so i kinda need some tutoring... been teaching myself some scripting. Most of the stuff I just copy of sites. what baffles me is the little flags that appear in this line: ...
0
votes
0answers
346 views

Getting a setting, the chdir value, out of GNU Screen

I've been using screen's chdir command to set a new working directory for new screen windows, more on that later. What I need to do is find out what the setting was before I set it, so that I can set ...