Bash is a free shell for Unix-like operating systems from the GNU Project.

learn more… | top users | synonyms

0
votes
1answer
24 views

Pipe arguments into “open” command

I'm trying to open a large list of .xml files using the following command: ls | grep navigation-drawer-config- | open However, this doesn't work. From my understanding of piping, this should pipe ...
0
votes
1answer
17 views

echo does not apply a line to crontab

Want to apply this to crontab: crontab -l > nopass echo 'ALERT - Found a user without password on:' `hostname` `date` | cat /etc/shadow | awk -F: '($2==""){print $1}' | mail -s "Alert: Found a ...
0
votes
0answers
15 views

How to add .bash_profile in Windows to run Matlab-based IPython notebooks

I'm looking at this tutorial to run matlab code in IPython notebook: http://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/. but I am stuck at step3: I edited the .bash_profile file located ...
0
votes
2answers
15 views

How to join files using 'tail' command while displaying limited lines

I have multiple log files and I want to display its joint output. One way of doing this is by executing this command: tail file-1 file-2 But I also want to display only a specific number of lines ...
0
votes
1answer
28 views

Bash Permission Denied on all files in my ssh

I just logged into my linux ssh that I had been using all last year for the first time since Holiday break and I am trying to view my files with less file and head file but I am getting Permission ...
3
votes
1answer
24 views

Pass arguments from script to PHP interpreter is not working with quotes, why?

I need to create a wrapper script for PHP interpreter (already in PATH): #!/bin/bash # This is a wrapper for the PHP interpreter. # # We prepare the enviroment for SQL Anywhere PHP extension sourcing ...
1
vote
1answer
41 views

how to “trace” a program such as shell?

I understand that dash is a "model" shell - it was written recently and well and it only implements what is required of POSIX shell. I looked at the dash source code to understand how "tracing" of a ...
0
votes
3answers
39 views

How to run a bash script at boot-time

I know this question has been asked several times but I simply can not get it to work. Here are the steps I have taken to get it working: wrote script saved as collection.sh moved collection.sh to ...
0
votes
2answers
40 views

How to get HTML file as a content to mail (shell script)

I am new to shell script, I have an HTML file which contains table data. Now I need to send this file to mail. mail -s "test" abc.com <test.html Currently I am getting the raw HTML code for the ...
0
votes
1answer
23 views

Use grep to NOT see files matching a pattern?

I'm very familiar with using grep with the pipe to exclude everything that doesn't match a pattern. But can I use grep to exclude everything that DOES match a pattern? I thought this would work, the ...
1
vote
0answers
23 views

How can I configure git bash to display a timestamp for each command?

I run git's bash on Windows7 to manage source control for projects. Can I edit C:\Program Files (x86)\Git\etc\git-prompt.sh to enable me to timestamp when I ran commands? e.g. instead of ...
1
vote
2answers
38 views

$HOME/bin is not appended to PATH in Linux Mint

I created the folder $HOME/bin and put some symbolic links in there. Furthermore I set the checkbox Run command as login shell (according to this question) in the Terminal properties. Now when I ...
0
votes
1answer
28 views

Populate command line from script

I have a PHP script that goes through a lot of complication and, in the end, produces a command for the user to run. Right now, it prints the command and then quits. The user has to copy the command ...
0
votes
1answer
68 views

Error executing remote commands with ssh using sudo user

The following command is failing: ssh -t user@server-01 sudo -iu suser "cd /opt/jboss ; ./portal.sh stop" I getting: bash: ./portal.sh: No such file or directory How can I change directory ...
0
votes
1answer
21 views

How do I encode the FLV to a temporary file and then output that to stdout with FFMpeg?

I know ffmpeg supports piping. I am trying to achieve what was described in this answer quoted below If you are willing to accept a solution that does not truly stream the resulting frames, but ...
0
votes
1answer
21 views

What does || : mean in the context of a shell script?

What does || : mean in the context of a shell script? I just came across this line: eval "/usr/bin/mybinary aparameter" || :
0
votes
2answers
17 views

looking for list of symlinks in Dropbox folder - find syntax not working

I am trying to move my Dropbox folder from an External Drive to a different External Drive. I was getting error messages that files couldn't be moved and according to Dropbox tech support it's ...
1
vote
1answer
23 views

How to create menu for environment variable names and values starting with $zv?

Wow! I've been browsing similar questions for 2h+ here! I'm sure I just want a quite simple thing. In a bash session with many functions we have dozens of directories to visit. Their names are all ...
1
vote
1answer
17 views

How can I direct my output to screen and to file simultaneously?

Linux, (Ubuntu) here. Should be effective every time I open a new terminal. Output to file should contain all messages including errors and warnings, should be the same as shown in the screen. Can ...
0
votes
1answer
22 views

How to tell bash to repeat a script until satisfactory, then output the finished product

I'm looking to repeat this code until I stop it, either by setting a time for which it repeats, pressing ^c, or set number of iterations, and then output the result of repeating it. The code should ...
2
votes
1answer
95 views

Redirecting command output in docker

I want to do some simple logging for my server which is a small Flask app running in a Docker container. Here is the Dockerfile # Dockerfile FROM dreen/flask MAINTAINER dreen WORKDIR /srv # Get ...
0
votes
2answers
38 views

ambiguous redirect error for simple echo

I have come across an oddity when performing a simple echo command. Can can anyone explain what's going on? Here's the scenario, there are exactly three files in a folder and I want to replace their ...
3
votes
2answers
40 views

make file size at least 1MB

I'm trying to learn about operating systems by making one myself and testing it in virtual-box, but VBoxManage convertfromraw doesn't allow my source file to be very tiny (512B). Are there any bash ...
0
votes
1answer
40 views

How do I find directories with a question mark in the name? Escaping not working?

I am try to find directories like services-client?.git using the command find . -name *\?.git but get all directories ending in .git What I'm doing is downloading a file from amazon s3 and in ...
1
vote
1answer
18 views

Sorting a comma separated file by the first column while preserving some order

I have a file of the form: kl2,LL kl2,nan kl2,MORE kl2,PRQ kl2,JJ abc87,PRQ abc87,JJ abc87,nan abc87,MORE abc87,LL ... and I would like to sort this by the first column, while leaving the second ...
1
vote
1answer
45 views

How to mail output of shell script as a cron job

I've created a cron job that runs a shell script. I'd like the shell script to run and capture it's output and have it emailed upon completion. Here's what I have so far, but the mail message body ...
1
vote
0answers
35 views

Is there a name for the command line user interface employed by projects like Git?

There are quite a few command line tools (or suites of tools) out there these days which use a command line interface such that every command starts with the name of the application/tool followed by a ...
0
votes
1answer
30 views

Delete files if condition is met

I have the following directory tree: /Directories/ /Directories/somedir/somefile.mkv /Directories/somefile.rar I'm trying to find a way to delete the .rar file if the .mkv file exists and is larger ...
1
vote
1answer
35 views

Unintended escaping of double quote in Bash

I am trying to add the following Git alias as a command in Git bash (windows user here). yolo = "!git init && git remote add origin $1 && git pull" None of this seem to be working. ...
0
votes
1answer
34 views

bash scripting: too many arguments in if

I have an if condition within a for loop over folders within a given directory, checking if a particular file exists within each folder, and skipping that folder if it doesn't. The if condition gives ...
0
votes
3answers
36 views

Substring in string in bash?

What is the equivalent of the python statement in bash: if "mystr" in "a long string with mystring in it": print("found string") The offset in number of characters can NOT be relied on to be ...
1
vote
0answers
11 views

mysqldump via launch daemon on mac osx not working

I'm trying to create a mysqldump of a database via bash script, and automate the process by using Mac's launchd / launchctl process. I can successfully run the bash script manually to backup the db in ...
4
votes
1answer
50 views

Files with space in name

I have a variable called var that stores the list of files inside a directory. I loop through all the files and if I find a directory I output "Directory" to the screen. code below: var=$(ls dir) ...
3
votes
0answers
16 views

How can I pass content of Chrome internal page to a shell script?

I would like to be able to pass the content of this internal chrome page to a file "about:gpu" but I don't know how. All this with bash commands. I would appreciate your help
0
votes
0answers
31 views

How can I export ubuntu terminal's profile in another computers?

i have the next commands this command for save my current terminal profile settings gconftool-2 --dump '/apps/gnome-terminal' > gnome-terminal-conf.xml and this other to load these save ...
1
vote
2answers
33 views

Wget Bash Script File Not Found

I have the following script: for i in {1..16}; do $wget http://url/$i.jpg -O C:/Users/User/Desktop/Test/ done Saved the file as test.sh and run it within Git on windows. The files are live on the ...
0
votes
1answer
33 views

Setting startup script without update-rc.d

I am currently working on a Yocto based raspeberrypi which doesn't have update-rc.d (or almost anything for that matter) and I'm trying to make a script run at startup. I added it in /etc/init.d but ...
-1
votes
1answer
99 views

Ping not working as expected

This is kind of a follow up to this question. My goal in the end is to use my Raspberry Pi 1 Model B to log whenever the Internet connection goes down, and for how long. I tried doing that with the ...
9
votes
4answers
212 views

How to quickly get the previous line output in a terminal without using a mouse?

Linux (e.g. Ubuntu) terminal, is there a method to get the last line? Say I am randomly typing a td command, which has not been installed on my system, so I will get a message like below. I would like ...
0
votes
1answer
36 views

What does xargs do exactly in this case?

I recently came across the following two examples Example 1: List only directories ls -l | grep "^d" Example 2: Search inside files ls | xargs grep -i "Find Some String" Now i have read from ...
0
votes
1answer
32 views

Cant view my Applications directory contents because of Chrome

I'm try to reach the contents of a specific application via terminal but every time I cd into the Applications directory and the ls I get the following Admin-MacBook-Pro:~ admin$ cd Applications ...
0
votes
2answers
21 views

Using one prompt input for two different functions

I would like to make a time lapse movie in a specific range. The script is working until it makes the movie. Here the script: read -p "Von welchem Zeitraum soll der Zeitrafferfilm sein? ...
3
votes
2answers
190 views

Ubuntu: Run the output of another command

I have command line that outputs a different command line, for example: > commandlineA param1 param2 commandlineB param1 I would like to have a single command line execution that will run ...
0
votes
1answer
25 views

Setting up an alias in zsh, storing additional information

I am trying to build a triplet of aliases in zsh. jc, g1, g2, jc arg1 arg2 would be the same as the command cp -r arg1 arg2 And g1 is the same as cd arg1 and g2 is the same as cd arg2 The ...
0
votes
2answers
39 views

ctrl+x/c/p (cut/copy/paste) subsitutes in Unix bash?

I can't find any documentation that shows the equivalents for ctrl+x, ctrl+c and ctrl+p (cut/copy/paste) in Unix (and some other equivalents but these are more than enough to start with).
0
votes
1answer
32 views

Not able to login by PuTTY Network Error

I have reset the user ("sftuser"), after that I am unable to login to the server, its throwing an error when logging in using putty: PuTTY Network Error: Software caused connection abort I am ...
0
votes
0answers
30 views

How to find files modified in last 24 hr but do not find from hidden directories and sum them

I have following command to find files modified in last 24 hr and sum all of them. #!/bin/bash find /mnt/naspath -mtime 0 -print0 | du --files0-from=- -hc | tail -n1 >> /tmp/size.log exit 0 ...
0
votes
2answers
43 views

Untarring into a temp directory, then deleting the directory

I'm a very new linux user, and I'm untarring a tarball into a directory, say that without smiling. What I want to do is create a temp directory with the mktemp -d command and use the tar command to ...
0
votes
0answers
69 views

OS / System / Command Injection query in Linux

I found a command injection vulnerability in Linux. The system does not allow any white space characters meaning The following command works: ;ls But I want to provide command with space, like: ...
0
votes
0answers
51 views

Why do I get this “Could not find /tmp” error from Git (or bash.exe)?

I am using Git to manage our project sources. For the continuous use, I employ a couple of active environments: TortoiseGit, for visual operations and immediate status feedback. Cygwin, through ...