All questions with tag [unix: bash]

0

How to use `ls` to group and show only a first word of directory name?

I intend to specify a new ls command to do something similar to this The first when i usage average ls command: $ls undergrade.AI undergrade.KDD undergrade.AI2 undergrade.micro undergrade.ANN undergrade.OOT undergrade.autoMata undergrade.OS undergrade.bulletin undergrade.parallelAndDistributedP...
2022-07-25 20:46:40
0

Segmentation fault with dialog

I'm obtaining a segmentation fault with the adhering to manuscript when it is extra that youngster dir past the pwd. The program eliminates with the mistake message and also I need to reset the shell. As an example: I start in / and also run the manuscript. I browse to from / to /etc simply great. When I attempt to head to /etc/httpd/ that is w...
2022-07-25 20:45:52
0

counting chars using bash

I'm fairly new to bash, and also I'm attempting to count the variety of chars in a documents. I created the adhering to function: function chars(){ m=$(cat $1) m=${#m} echo $m } calling it with echo $(chars $2) results on a documents the number 524, while calling wc -c on the very same documents results 525. What creates the distinc...
2022-07-25 20:44:28
0

Suppress "Alarm clock: 14" from ping

I've made a straightforward manuscript for restarting my router and also after that revealing a progression bar till my computer system has a net link once more. When running the manuscript I get the adhering to output: The router is now rebooting... ############################################bin/reboot_router: line 48: 4758 Alarm clock: 14 ...
2022-07-25 20:43:30
0

Finding a char device in /sys using a Bash script?

I have one of and I am trying to write a Bash script for finding the device path in /sys. My approach goes something like this: start in /sys/modules/usbled since this is the name of the kernel module loaded when the device is plugged in cd to drivers/usb:usbled, which appears to be the bus and name of the driver for the device (according to )...
2022-07-25 20:42:57
0

integer expression expected bash

Trying to loop an expression inputted by the customer a set quantity of times that is additionally inputted by the customer. Go on obtaining the mistake integer expression anticipated, and also I can not identify just how to repair it. #!/bin/sh echo "What do you want to say?" read phrase echo "How many times?" read num w...
2022-07-25 20:42:38
0

Batch file move to directory structure based on filename

I am creating a manuscript to relocate documents right into directory sites based upon the filename. Documents have yyyyddmm-xxxxxxx.jpg name layout. The wanted directory site framework remains in the layout 2013/01 Jan/31. I am incapable to get date to layout appropriately with a room in between month number and also month name. When I attempt ...
2022-07-25 20:41:54
0

Array Cartesian product in bash

Is there a means to create cartesian item of selections without making use of loopholes in bash? One can make use of curly brackets to do a comparable thing: echo {a,b,c}+{1,2,3} a+1 a+2 a+3 b+1 b+2 b+3 c+1 c+2 c+3 yet I require to make use of selections as inputs, and also the majority of noticeable methods fail me.
2022-07-25 20:41:11
1

Does bash recognize a variable declaration as string if you do not put the quotation marks?

name=Jackson echo $name This will certainly present Jackson. name="Jackson" echo $name This will certainly additionally present Jackson. So I think by placing quote marks around a variable it is making it a string. What would certainly call = Jackson practically be? Would certainly it additionally be identified as a string?
2022-07-25 20:40:13
0

Get scan codes in octal format

Using showkey -s I can get the scancode of a key as a hex - number. Just how can I get it straight as an octal number?
2022-07-25 20:40:05
0

How to find frequency of occurrences of strings contained in a file?

I have a documents which contains a checklist of URLs of the kind EDIT $% ^$ &, www.google.com, google.com yahoo.com/list/page/jhfjkshdjf I intend to write a manuscript that will certainly present the list below result google.com : 2 http://www.google.com: 1 yahoo.com : 1 I am stuck to the component that I need to read the UR...
2022-07-25 20:39:58
0

Pipe to multiple files in the shell

I have an application which will certainly generate a huge quantity of information which I do not desire to store onto the disk. The application primarily outputs information which I do not desire to make use of, yet a set of valuable details that have to be divided right into different files. As an example, offered the adhering to output: JUNK ...
2022-07-25 20:39:47
1

How to inspect group permissions of a file

I would love to evaluate team permissions of a documents from a bash manuscript. Especially, I require to examine whether a documents has the team writeable little bit on. That is it. Straightforward as that. However: I additionally require this to be mobile test -w <file will not inform me whether it is team writeable The result o...
2022-07-25 20:39:14
3

'Binding' Bash Curly Braces

In Bash, echo a{b,c}d{e,f} prints abde abdf acde acdf The output I'd like to see is abde acdf In other words, given N parameters, I'd like Bash to use the ith parameter within each pair of braces to construct N strings.
2022-07-25 20:26:11
1

Using 'convert' with files that has space characters?

for f in $(ls mydir/*.jpg) do convert -thumbnail $size -quality $quality $f thumbsdir/$(basename $f) done I'm attempting to code a manuscript that takes a directory site with photos and also creates thumbnails from these photos. The manuscript runs well, yet when it reaches photo documents that include room personalities, it offers me mist...
2022-07-25 20:25:59
4

How to unrar and unzip files recursively?

I have a massive documents which contains zips and also rars with zip and also rar documents situated within on a linux box. I primarily require a manuscript or one - lining that will recursively quest via the directory sites and also unzip and also unrar any kind of rar or zip it locates.
2022-07-25 20:25:56
1

Trying to cp a path with spaces, fails when scripted but echoing and pasting succeeds?

I have a manuscript that is attempting to replicate a directory site from a course that consists of backslash - ran away rooms and also is saved in a string variable to a subdirectory of the functioning directory site. When I run the manuscript, I get the use for cp: usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file ...
2022-07-25 20:25:52
1

What command will generate average lines per minute?

I'd like to know how many average lines are written to a file per minute.
2022-07-25 20:25:52
0

How do I stop bash from hanging when trying to start programmes while NFS is disrupted

I am currently experiencing which means that when I resume my machine after a suspend, the network connections do not come back up. I have a couple of NFS mounts and because they are in a hung state, any time I try to run anything on the command line (eg. the workaround in that bug report: nmcli cli sleep false) the shell hangs. By "hang&q...
2022-07-25 20:25:41
1

bash environment - pasting strings with "special" characters

I'm making use of an application and also I require to paste a string right into the application e.g. ãµÜÇæjc22cjüäÄøqò When I login with bash covering it is difficult to paste the string with the unique personalities. If I transform the covering to sh it functions penalty. Does a person recognizes what/if there are any kind of variabels that...
2022-07-25 20:25:15