The shell is unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …).

learn more… | top users | synonyms (1)

0
votes
1answer
17 views

Unable to extract to specific directory

I am trying to extract to file to specific directory but it doesn't produce result Operating system : SunOS Command: zcat /export/home/tceng/Desktop/temp/3.tar.Z | tar -xf - -C ...
2
votes
1answer
27 views

Windowless xterm? (Faking a terminal for a process)

I'm fighting with a rather odd problem with Matlab. The startup script is located in /opt/matlab_2013b/bin and is called matlab. When I run it in terminal, it works fine. But I want to make a ...
0
votes
3answers
45 views

How to use password in shell scripting

I am writing a script which greps for for multiple files from 3 log files. One of the log file is created as superuser and every time it executes it prompts for password. How do I put it the same ...
0
votes
0answers
27 views

delete non important characters from command output

the version command in my Linux machines display the following output version Red.Hat.OS. release..........5.5 APP.Release.............4.2.0.0-02 how to remove the middle "." dot character ...
4
votes
2answers
240 views

How to echo `single quote` when using single quote to wrap special characters in shell?

I'm reading shell tutorial today from http://www.tutorialspoint.com/unix/unix-quoting-mechanisms.htm In which it mentions: If a single quote appears within a string to be output, you should not ...
1
vote
1answer
38 views

When did bash quit exporting SHELL?

I upgraded a Debian box from stable to Jessie and I noticed that SHELL is no longer exported, so screen and similar programs start dash for subshells instead of bash. When was this change made and ...
7
votes
4answers
562 views

Spaces next to pipes

I've seen history | grep blah and history |grep blah; and history|grep blah also works, though no one ever seems to use it. Is there any significance in the spaces (e.g. piping to/from different ...
0
votes
2answers
35 views

Gzip file but excluding some directories|files and also append current date

I'm looking for a way to create a .tar.gz file from a directory but I have some doubts. I'm know that the command for create the file is: tar -zcvf /path/to/compressed/file.tar.gz /path/to/compress ...
0
votes
1answer
22 views

explain this shell command with redirection and pipe

I can understand the statements like. bzip2 --version >/tmp/list_right 2>/tmp/list_error bzip2 --version >/tmp/list 2>&1 But I don't understand the statement: bzip2 --version ...
1
vote
2answers
53 views

use “read” command to pass lines as positional parameters to a shell script

The following file runs, but not doing anything, yet it does not error.... while read dates; do ./avg_hrly_all_final.sh ${dates}; done < ./dates_all.csv I have a list of dates in ...
1
vote
1answer
19 views

Multi-platform web based terminal emulator

Is there a web-based terminal emulator compatible with all device like pc browser, smarthphone and tablets (android and iOs)? I tried shellinabox, but with iOS doesn't work correctly (can't activate ...
1
vote
0answers
38 views

Bash cannot see PATH update

I am running Debian on a VM. I login to the GUI and go to Applications > Accessories > Terminal. # echo shell: /bin/bash I modified ENV_SUPATH, ENV_PATH inside of /etc/login.defs. I restarted ...
1
vote
0answers
59 views

Sed regex printing into a file.txt

I'm connected to a MQTT stream, and I filter out the data by entering : mosquitto_sub -d -t +/# 2>&1 | sed -n "/PUBLISH/{s|.*\('.*',\).*|\1$(date),|;N;s/\n//;p}" into the Ubuntu terminal. ...
4
votes
2answers
48 views

How to get the real name of the controlling terminal?

How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname? By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
0
votes
1answer
29 views

looping through a file on 2 lines in shell

I have a file which looks like this: >a TCCACTCCACGC >b ACCTCCAG I want to loop through the file in such a way that it takes into account 2 lines at a time i.e >a and its sequence and then ...
2
votes
1answer
40 views

attempting to put dynamic input data in a variable via cat method

I'm attempting to write a bash script that should be able to collect data from ttyS0 and put in a variable. I need to talk with a device on the serial line, that is a module able to receive AT ...
4
votes
2answers
55 views

How can set a row as column in unix [duplicate]

How can I set a row as column in Unix. Example: name : Keshav sub : C++ branch: cse DOB :22/09/1990 company:NONE name : Vijay sub : Java branch: cse DOB :22/09/1985 company:NONE I want output ...
0
votes
2answers
46 views

how to save the contents of a webpage in a file using shell script

how to save the contents of a webpage in a file using shell script. Web page is using URL, username and password to open. curl -O odcview:password ...
10
votes
3answers
952 views

What's the difference between semicolon and double ampersand && [duplicate]

What is the difference between echo "Hello " ; echo "world" and echo "Hello " && echo "world" Both seems to run the two commands after each other.
-1
votes
0answers
15 views

Count Unique values of Variable in Unix [on hold]

I have stored a column value in a variable I want to count unique values in the variable. How can I do this?
4
votes
2answers
56 views

How to delete part of a binary file without copying

I need to delete the first 2 bytes of a 6MB file. However, this is an embedded Linux with only 32 Mbytes RAM and less than 1 MB free flash memory. I tried using dd, as: 1 - # dd bs=1 skip=2 ...
0
votes
0answers
29 views

Unrecoginzed option: using 'getopt' cmd in shell script [on hold]

What is wrong in the command: if ! options=$(getopt -n myscript -l a:,b:,cc:,dd:,ee:,ff:,gg:,hh: -- "$@"); then exit 1; fi I get an error msg: mhagent: unrecognized option '--hh' options=' --aa ...
1
vote
1answer
27 views

if command in find -exec

I was just trying to list all directories and files under current directory and also write if they are file or directory with the following command: find -exec echo `echo {} : ;if [ -f {} ]; then ...
0
votes
2answers
29 views

What I am doing wrong with this bash variable? [on hold]

How can I insert a variable into a command? In the case below, I need to concatenate the command with the variable file name. #!/bin/bash # Define a timestamp function timestamp() { date +"%D-%T" ...
1
vote
1answer
35 views

How can I get $PATH to always include $(pwd)/sub_directory/.bin

If the path ~/dev/project1/node_modules/.bin/ionic exists, and my working directory is ~/dev/project1, I would like to be able to just type ionic and hit enter. I could include all those ...
3
votes
1answer
235 views

Chaining pipe | with &&

I have this command where I want to filter make output: cd /app && make && sudo nginx -g 'daemon off;' What is the correct way to insert make | pv -q -L 100 here?
-1
votes
2answers
25 views

if else statement

I have a case statement inside some of the if statement, but after doing the case statement inside the if statement, the loop ends. After the case statement, it is supposed to go to the next value on ...
0
votes
3answers
76 views

Using grep in shell script

I have a text file which looks like this(I am showing few lines of it) INDEX : 1 snRNA_seq:TTTTGGAGCAGGGAGATGGAAT miRNA_seq:CTCCTGACTCCAGGTCCTGTGT target: ...
1
vote
1answer
320 views

shell command to know computer manufacturing date [closed]

as object, I would like to know when a computer was built and also last OS installation date
0
votes
1answer
30 views

How can I multiply a column by a variable and write out? [duplicate]

I would like to multiply a single column in a .txt file by a variable and then write to another .txt file. What am I missing from the awk line? Appreciate any help in advance. !/bin/bash ...
1
vote
0answers
59 views

What is the meaning of the string **/* when used with grep?

I came across this picture (below), obviously it is a pun or some kind of allusion incorporating command-line expressions. Frankly speaking I do not understand anything of it except for grep -n. ...
2
votes
1answer
36 views

Can we use two brace expansions together?

For example, I want to rename a file abc to bd. Why doesn't two brace expansions work? How shall I make brace expansion work in my example? Thanks. $ touch abc $ mv {a,}b{c,d} mv: target `bd' is not ...
1
vote
3answers
68 views

How do you parse through a subdirectory where the path contains spaces? [duplicate]

I'm trying to parse through a set of files in a directory on a mapped drive. However, I can't seem to resolve an issue that seems to be because of spaces in the path to the subdirectory. Would ...
0
votes
2answers
30 views

A batch that cout the number of occurrences

I've to extract the number of words using each letter of the alphabet from A to Z. The script that i've to create create take as parameter the name of the dictionary file to analyze and will be used ...
-3
votes
0answers
23 views

How to configure the Shell if no .bashrc exist ?

I have a problem with my Xfce Terminal, once I start it it does not respond for a minute. I was told here to change settings in the .bashrc configuration file. Unfortunately no such file exist. What ...
1
vote
1answer
25 views

How do I control output after executing a command?

.. Script Run Complete. You have new mail in /var/spool/mail/<user-name> -bash-3.2$ I have seen the above message most the times on my prompt, probably while it's idle or as soon as script ...
1
vote
2answers
70 views

Is there any way to make scripts dynamic? [closed]

I need my script to show the time till next run, continuously like a timer, is this possible?
2
votes
1answer
39 views

Produce aligned columns in a shell script

In shell how do I have an even length of spaces by the length of words on my menu? I've tried to get the length of the longest character string and then create each column length by the longest ...
-2
votes
2answers
36 views

Not able to run shell script using cron [closed]

I have a shell script test.sh in /home/username The test.sh file contains the following lines - #!/bin/sh cd /home/username/bin sh launch.sh ParameterName #launch.sh is in /home/username/bin ...
2
votes
2answers
26 views

How can I copy and move a sequential subset of files?

I have a directory containing 1772 files named PRC0001, PRC002,... up to PRC1772. How can I copy a subset, for example PRC0257 to PRC1516 to a different directory? I am trying to do this for several ...
1
vote
3answers
51 views

how to express line feed in shell?

Im my debian7.8 bash shell. str="deb http://ftp.cn.debian.org/debian/ wheezy main contrib non-free \n deb-src http://ftp.cn.debian.org/debian/ wheezy main contrib non-free " echo $str > ...
0
votes
1answer
42 views

Shell Concat string from config file

I have created config.cfg like this DB_USERNAME='abcdef' DB_PASSWORD='1234' Then my shell.sh have read config and try to concat string #! /bin/sh source config.cfg ...
0
votes
1answer
43 views

property file reading from unix shell [closed]

Below is the sample code. products=$PRODUCTS arr=$(echo $products | tr "," "\n") for x in $arr do with="${x}SUBPRODUCTS" subproducts=$(echo "${x}SUBPRODUCTS") echo ...
3
votes
3answers
171 views

How to match * with hidden files inside a directory

How to match the hidden files inside the given directories for example If I give the below command it's not giving the result of the hidden files, du -b maybehere*/* how to achieve this ...
2
votes
1answer
32 views

What's the easiest way to detect what signals are being sent to a process?

I'm trying to debug an issue with my shell (specifically, fish) sending signals to my background processes. I'd like to be able to recognize what signals a process is receiving. Ideally, I'd like ...
2
votes
2answers
41 views

Why `until` block is designed as it is just a negative version of `while`?

To my understanding, until block is just the opposite version of while, like until "condition A is met" is equivalent to while "condition A is not met". In some modern languages such like python, ...
-1
votes
2answers
37 views

Just open the link [duplicate]

I just want to open a website link using the terminal in ubuntu. I am using the following code:- firefox https://anylink.com the problem is that once this command is executed, the terminal does not ...
6
votes
5answers
118 views

execute a command in $PATH matching a wildcard

I'd like to find and execute a command in the current $PATH matching this wildcard libreoffice?.? (eg. libreoffice4.0, libreoffice4.3, etc.) EDIT: if multiple matches are found, you can pick one ...
0
votes
2answers
40 views

Why can't I kill the shell using the PID obtained from the $$ special variable? [duplicate]

After I have learned that the $$ special variable holds the process number of the shell, I tried too kill the shell by simply: kill , however this did not work, I also tried some variations, but them ...
0
votes
2answers
37 views

What is the meaning of the number displayed by echo $$ ?

By accident I typed "echo $$" into the command line, but instead of an error message I got a 5 digit number. I repeated "echo $$" on different terminals and each time I got a 5 digit number. What is ...