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

learn more… | top users | synonyms

1
vote
0answers
15 views

How to use linux bash “sort” command in a portable script?

I am writing a bash script and I want to make it portable, to have the same results in the other computers. From this question I learned the system settings, like language settings and possibly other ...
0
votes
1answer
18 views

Unexpected result from sort command of linux bash

I have a file foo.txt with this content: chr1 15 chr11 5 chr11 8 chr1 7 chr2 23 chr1 35 I tried to sort it first according to the first column, and then according to the second ...
0
votes
0answers
2 views

Create aliases on host during vagrant up using vagrant-triggers

Hoping someone can help me out here. I am wanting to create aliases on my local machine (host) when running vagrant up. Through my search for vagrant run command on host, I came across the ...
-1
votes
1answer
17 views

find all IDs and CLASSes used in an HTML document in BASH

I have a block of HTML that I need to pull all the IDs and CLASSes out of. Im wanting to make a list of these so that I can start trimming our larger then necessary CSS doc (173k). Ill isolate the ...
3
votes
2answers
43 views

How do you CD change directory into the absolute path of a symbolic linked directory?

I'm currently in a symbolic link directory and I want to go up one level in the absolute path, but I cant as it will hit me back up to my home directory (~). I can do pwd -P to get the absolute path, ...
0
votes
1answer
18 views

RPM command stuck/FREEZE when installing RPM file

I want to install the following rpm from some reason RPM is stuck or freeze and not install the RPM package also I cant stop it by control C , please advice what could be the problem ? root]# rpm ...
3
votes
1answer
12 views

In bash, declare an alias that depends on current variable content

I would like to declare an alias in my .bash_profile that will use the content of a variable when the alias is used and not when it is declared. Ex: alias goSomeWhere="cd $BASE/somewhere" When ...
0
votes
1answer
23 views

Delete All files except specific file in bash

I am trying to use rm -rf !(current) delete all folders in current path except current folder. But I am getting below error bash: !: event not found How do I get this functionality in bash?
0
votes
1answer
20 views

Windows batch equivalent of bash's set -e

Is there a Windows batch equivalent to bash's set -e, which causes the shell to exit immediately if a command fails with nonzero exit status (except in places where it's expected like in an if ...
0
votes
1answer
14 views

Kill browser tabs with Bash from younger to older

Hello i want to kill tabs from a browser(ex. chromium) by order from youngest to oldest. I used pkill -f -n -9 chromium but i want to use it in a while iteration with comparison to pkill's return ...
1
vote
2answers
39 views

What does ./ mean in Unix/Linux [duplicate]

This might look wrong, but I know that using ./ you are basically "BASH"ing your scripts in Linux/Unix environment. For Windows users, this is same as running an .exe file from command prompt. ...
0
votes
1answer
29 views

remove spurious ending spaces when copy pasting from emacs console mode?

I'm not really sure where this comes from but it's really annoying: Using emacs in console mode, and when I want to copy from emacs and paste to another application (possibily another term) I often ...
1
vote
0answers
12 views

Centos Kickstart Multiline Cat

I have a serious of multiline cat commands in a kickstart file under the %Post section. For some reason all the lines get written to the same file. Example: %post --interpreter /bin/bash ...
0
votes
0answers
17 views

How is a basic daemon made on OSX?

I have an OSX system that I'd love to have some daemons set up on that will automate the updating of all of my console utilities. How would I go about creating and running such daemons? I'd also like ...
0
votes
1answer
16 views

Delete a file inside multiple ZIP archives on the OS X command line

I'm trying to delete files with specific extensions from multiple zip archives. For example I want to delete all .html files contained in the zip archives in the current path so I have tried this: ...
1
vote
2answers
27 views

Restarting process in CentOS if server restarts

I have a VPS with some Java applications (made with "Play Framework") running on ports 9000, 9001, 9002 and 9003. VPS Provider (iPage) happens to reboot servers unexpectedly from time to time, leaving ...
0
votes
1answer
13 views

cp: fts_open: No such file or directory / Why?

I have following bash script: #!/bin/bash echo "This script will copy all JPG files inside directory '~/temp/merged':"; pwd; read -r -p "Please confirm, that you want to copy all JPG files [y/N]" ...
0
votes
0answers
10 views

gfortran not working on my Mac OS X

I tried running gfortran on my Mac OS X, but it wouldn't work. When typing gfortran in the terminal I got the error -bash: gfortran: command not found. So I thought maybe my installation was not ...
-1
votes
1answer
47 views

Can't understand loops :( [on hold]

I'm trying to understand better the while and until loops, can someone help me with this example? #!/bin/bash # Listing the planets. for planet in Mercury Venus Earth Mars Jupiter Saturn Uranus ...
0
votes
1answer
29 views

Combination of Echo and >> operator command

I was learning how to configure Django on OpenShift and got stuck with following commands. Can anyone help me to find out what operation is performed by these commands here and what can be its ...
-4
votes
1answer
28 views

Shell script for going through files and deleting or compressing them

List, one at a time, all files larger than 100K in the /home/username directory tree. Give the user the option to delete or compress the file, then proceed to show the next one. Write to a logfile ...
0
votes
1answer
24 views

Awk script to run a command based on condition using 'if'

I have a piece of code here that basically takes a file called 'srcip' (which is just a list of IP addresses) and compares it to my '~/db' file which is just a tab delimited IP HOSTNAME database of ...
0
votes
1answer
32 views

is there a way i can either insert a character into a line or substitute and arbitrary character with itself plus some other carachter(s) in sed?

like say i have a string of numbers that constitute a phone number and are like so ########## and i want to format them like : ###-###-#### insert only puts in new lines, and i dont know how to ...
0
votes
2answers
30 views

Alter output of every command

I'd like to know if there's any way of altering output of every command I execute in terminal. The purpose is to make the output formated for my markdown howto's. E.g. ls -la .*z #>-rw-r--r-- 1 ...
0
votes
2answers
29 views

linux cat into file including exiting code all from copy+paste

Can I print out a code to STDOUT that would mimic the behavior of Ctrl+c inside cat? E.g. I would like my script to print out the cat command followed by the content of the file like this: cat > ...
0
votes
0answers
6 views

Is “Lynx: can't access startfile” normal when I'm looking for broken links? I'm kinda desperate

I'm doing a script in bash for checking broken links, is it normal that the dialogue "Lynx: Can't access startfile" appears when I run the script? This is my code so far: #!/bin/bash ...
1
vote
1answer
18 views

How do I insert a constantly changing (dynamic) string from a text document into .conkyrc as an image path

I want to change the Clementine album art with each song. Essentially, I am trying to insert an image path in Conky that changes every few seconds. I have a script clementine.sh that runs every 5 ...
1
vote
4answers
42 views

Grep to filter gigantic CSV file

I'm dealing with a CSV file that contains over 2 million lines. Quite a big one. I need to use grep (or any better way) to retrieve the entire row if the value of the second column matches 'jpn' or ...
1
vote
1answer
23 views

echo “something” > file not working when sh script is being executed by remote PHP server

I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server. Web-server ...
1
vote
1answer
26 views

Good way to bookmark/navigate relative directory paths?

I work on a linux system with bash 4.x where I frequently find myself navigating different copies of very deep (and large) file directory structures. However, in reality I only need to access a ...
0
votes
1answer
24 views

Creating a macro with .sh

so I would like to write a script that will be used in the following way. ./MakeMacro 1 The basic form of the script looks like this: #!/bin/sh ...
0
votes
2answers
25 views

How can I make bash cut and paste to the X selection?

In bash under an xterm, how can I get Ctrl-k / Ctrl-y to cut and paste to the X selection?
1
vote
2answers
29 views

reverse print without trailing

I have a bash file calling a dns zone and have piped out the fqdn which I need to output in reverse. The snippet below does that fine except I get a trialing . at the end which I don't want creating ...
0
votes
2answers
29 views

Perform Terminal Commands Without Opening the Terminal - Linux

Is there anyway, within Linux, to open a terminal or perform a terminal command (such as executing a script) without actually opening the terminal window. What i'd like to do is be able to execute a ...
1
vote
1answer
19 views

How to split and recombine stdout pipe in bash?

I am parsing text on the command line. How can I take the output of one command and use it in two places in the next command? some_command | head -n $( awk '/search_term/ {print FNR} ...
0
votes
1answer
26 views

Why do i get a file named history in each folder in bash?

For some reason I get a bash history file in each and every folder where I issue any command. The file is called history rather than the normal .bash_history. My .bash_profile has the following that ...
0
votes
0answers
36 views

Linux bash - Add alias from script without source(-ing) the script

Is it possible to write a script like #!/bin/bash alias foo="bar -options" and get the alias added to the running shell without source(-ing) the script source myscript will work, but just ...
1
vote
2answers
182 views

Why is “source <(cmd)” working but not “$(cmd)”

I want to have a script to call with params which adds some aliases to my current shell. The aliases have to be builded in respect to the calling parameters and the current directory from where I ...
0
votes
1answer
41 views

How can I run a bash script automatically?

I have a script named run.sh: #!/bin/bash cd /root/yowsup-master/src/ ./yowsup-cli --interactive no --wait --autoack --config config.example This script executes another script. I tried adding my ...
2
votes
1answer
39 views

Percent sign (%) in front of shell command

I just pasted a bunch of code into my shell, but forgot to remove the leading % before running the command. It appears to have done nothing. Why does this do nothing in my shell (zsh)? > % echo ...
0
votes
1answer
29 views

Linux find files in subdirectories by extension (.txz) then move them to specified directory using regular expressions

I have mirrored a directory from a server with a large number of sub directories, each of which contain a .txz package and the usual .txt and descriptor files. What I would like to do is the ...
1
vote
0answers
18 views

What triggers dropbox on fedora to upload files?

I am writing a computer simulation on a Fedora system, but wants to postprocess the data using MATLAB on a windows installation. My method for transferring files is Dropbox since the two computers are ...
0
votes
1answer
22 views

Is there a way to “source” a sh script from the fish shell?

I like to put many of my environment variable definitions in the .profile script. If I am using a POSIX-compatible interactive shell like bash, I can use the source command to re-export the ...
0
votes
1answer
16 views

Target directory structure for tar different than original directory structure

Is there any way to set a different target directory structure than the orignial directory structure the tar archive was created from without creating it by hand? For example, I have many files in a ...
0
votes
2answers
20 views

Move most recently modified file

I am trying to move the most recently modified file in "Pictures/". This is what I've tried: find Pictures/ -maxdepth 1 -type f -mmin -60 -print0|tail -1| xargs -0 -I {} mv "{}" Dropbox/somefolder/ ...
1
vote
2answers
36 views

Grep output from multiple lines in a limited shell environment

I have been scouring the web for ways to search across multiple lines of output and then print the lines which contain the strings I care about. I am actually running this on a checkpoint firewall, ...
0
votes
1answer
33 views

`if` statement with stdout && passing xargs through pipe

Say I have a list.txt of files I want to check. cat list.txt and for each file, I want to perform an action cat list.txt | xargs -I {} touch {} But depending on the outcome of the action, I want ...
3
votes
3answers
260 views

find command locking the system out

I had a folder , with 4+ million files in it. I managed to delete all files , in course of a week , using "find . -delete" and "kill -9" after a minute as it locks the system otherwise. now the ...
0
votes
0answers
7 views

Run xdg-open on mouseclick in a linux terminal emulator

I'd like the following functionality in a terminal emulator: after typing ls and pulling up a list of files, I'd like to be able to click on the file. This should runxdg-open on the file. This action ...
4
votes
1answer
253 views

Why does bash sometimes forget the command typed previously?

Came across a strange case on a Ubuntu Lucid system: bash command line is working fine most of the time, but for some reason sometimes Up doesn't work to recall previous command. It remembers the ...