Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

3 votes
1 answers
5514 views
How to run batch sas job in unix sas?
I have 5 SAS jobs that I need to run sequentially, one after the other. I typically type in `nohup sas filename1.sas &` in the command line to run and manually check for progress every few hours. If the 1st job is complete and no error, I then type in the 2nd job `nohup sas filename2.sas &` . Is the...
I have 5 SAS jobs that I need to run sequentially, one after the other. I typically type in nohup sas filename1.sas & in the command line to run and manually check for progress every few hours. If the 1st job is complete and no error, I then type in the 2nd job nohup sas filename2.sas & . Is there a sas code or unix command I can run them sequentially rather than manually checking progress? I thought about using %include statement in a master sas file, however I have many loop macros and do if then macros which throw the %include off I believe. PS. I also need the log and lst file to be printed, typically it's printed for me automatically using the command above.
SuperKing (81 rep)
Aug 15, 2016, 09:14 PM • Last activity: Jun 5, 2025, 08:02 PM
12 votes
1 answers
2860 views
Why does typing 'q' exit vim? (.man file)
When I type the character `q` on my keyboard in vim, it exits vim. Why? Today I tried it edit a file with the file extension `.man`. I wanted to edit the file with a macro, so I tried to type `qq` -- but when the first `q` was entered, `vim` closed! ``` vim test.man ``` This is on a fresh install on...
When I type the character q on my keyboard in vim, it exits vim. Why? Today I tried it edit a file with the file extension .man. I wanted to edit the file with a macro, so I tried to type qq -- but when the first q was entered, vim closed!
vim test.man
This is on a fresh install on Debian 12. I do not have a .vimrc defined. I renamed the same file with a .man extension to have a .txt extension, and this time I could create a macro as expected -- typing a q doesn't cause vim to exit.
mv test.man test.txt
vim test.txt
Why is vim exiting when typing a q when trying to edit a file with a .man file extension? And how do I stop this behaviour?
Michael Altfield (382 rep)
Mar 26, 2024, 07:15 PM • Last activity: Mar 27, 2024, 02:55 PM
8 votes
3 answers
3663 views
Interacting with X applications programmatically
I have an application which is built using GTK+. The application has a very simple interface. When started, the same window always opens, with a few input controls. We want to write a script to fill in text in a couple fields, check a check box, then click a button. Pretty simple, and would be easy...
I have an application which is built using GTK+. The application has a very simple interface. When started, the same window always opens, with a few input controls. We want to write a script to fill in text in a couple fields, check a check box, then click a button. Pretty simple, and would be easy to do if a command-line version of the app were available (but it isn't). What's the best way to approach interacting with an X application programmatically?
Tom Marthenal (406 rep)
Jun 13, 2013, 03:42 AM • Last activity: Dec 12, 2023, 04:59 AM
1 votes
1 answers
101 views
Mutt: ask before deleting messages from Trash
I have defined in Mutt two "trash" macros -- one for the Trash folder (just mark as deleted and sync) and one for the remaining folders (save into Trash and sync): folder-hook . 'macro index "s=Trash ^ "' folder-hook =Trash 'macro index " ^ "' Together with `set delete = yes` this results in message...
I have defined in Mutt two "trash" macros -- one for the Trash folder (just mark as deleted and sync) and one for the remaining folders (save into Trash and sync): folder-hook . 'macro index "s=Trash^"' folder-hook =Trash 'macro index "^"' Together with set delete = yes this results in messages immediately being expunged, no questions asked. Such a behaviour is fine outside the Trash folder, however, I'd like Mutt to ask for confirmation before messages are deleted from Trash. The only workaround that I have come up with so far is not to sync in the macro (i.e., use only `` there), thus having to live with deleted messages being present until I sync manually. (Which is not ideal...) Is it possible to change this setup so that -- in Trash -- Mutt would ask for confirmation before actually marking the messages as deleted and expunging them? Thanks.
nvx (65 rep)
Mar 15, 2023, 03:05 PM • Last activity: Nov 3, 2023, 11:29 AM
0 votes
1 answers
1759 views
How to resolve SAS macro variable in shell script
I am running a shell script via X command within a SAS macro. I want to use a macro variable defined in SAS macro, in my shell script. I know if I pass that macro variable as parameter to shell script, I can resolve that within X command. For example, the following will work fine, I know: ```sas %ma...
I am running a shell script via X command within a SAS macro. I want to use a macro variable defined in SAS macro, in my shell script. I know if I pass that macro variable as parameter to shell script, I can resolve that within X command. For example, the following will work fine, I know:
%macro a;

%let var1=test;

X "abc.sh &var1";

%mend;
%a;
with this shell script:
echo "value is $1" >  myfile.txt
--- ## What I want:
%macro a;

%let var1=test;

X "abc.sh";

%mend;

%a;
with this shell script:
echo "value is &val1" >  myfile.txt
--- Is there any way to resolve macro variable in shell script? I did my research but couldn't find anything.
Deepak Malhotra (23 rep)
Apr 12, 2019, 11:04 AM • Last activity: May 8, 2023, 07:50 AM
153 votes
6 answers
414234 views
How to comment multiple lines at once?
How can I select a bunch of text and comment it all out? Currently I go to the first line, go to insert mode then type `#` left-arrow down-arrow and then I repeat that sequence, perhaps saving a few keystrokes by using the `.` repeat feature to do each line. Is there anyway I could (for instance) se...
How can I select a bunch of text and comment it all out? Currently I go to the first line, go to insert mode then type # left-arrowdown-arrow and then I repeat that sequence, perhaps saving a few keystrokes by using the . repeat feature to do each line. Is there anyway I could (for instance) select either multiple lines in visual mode or by using a range of lines and an ex ('colon') command and for that range comment out all the lines with a # to make them a "block comment". The ability to quickly 'de-comment' (remove the #'s) for a block comment would also be nice.
Michael Durrant (43563 rep)
Mar 20, 2014, 04:14 PM • Last activity: Apr 25, 2023, 10:24 AM
15 votes
4 answers
9276 views
Can I launch macros and shortcuts from a second keyboard on Linux?
I have a small numpad keyboard which I would like to use for launching macros and shortcuts, along side my regular keyboard. I can attach macros and shortcuts to these keys (*i.e, numpad 1 minimises the active window*), but my primary keyboard numpad also activates the shortcut. I would like a way t...
I have a small numpad keyboard which I would like to use for launching macros and shortcuts, along side my regular keyboard. I can attach macros and shortcuts to these keys (*i.e, numpad 1 minimises the active window*), but my primary keyboard numpad also activates the shortcut. I would like a way to have the secondary keyboard act completely separately and to then attach shortcuts to it. Here is the output I get from xinput. ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ LVT Recon gaming mouse id=10 [slave pointer (2)] ⎜ ↳ LVT Recon gaming mouse id=11 [slave pointer (2)] ⎜ ↳ Corsair Corsair K30A Gaming Keyboard id=13 [slave pointer (2)] ⎜ ↳ SIGMACHIP USB Keyboard id=18 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Sleep Button id=9 [slave keyboard (3)] ↳ Corsair Corsair K30A Gaming Keyboard id=12 [slave keyboard (3)] ↳ Corsair Corsair K30A Gaming Keyboard id=14 [slave keyboard (3)] ↳ LVT Recon gaming mouse id=15 [slave keyboard (3)] ↳ Corsair Corsair K30A Gaming Keyboard id=16 [slave keyboard (3)] ↳ SIGMACHIP USB Keyboard id=17 [slave keyboard (3)] ↳ SIGMACHIP USB Keyboard id=19 [slave keyboard (3)]
umbro_tracksuit (377 rep)
Mar 27, 2019, 02:21 PM • Last activity: Feb 24, 2023, 10:00 AM
2 votes
1 answers
86 views
output redirection issue - m4 macro with self increasing build counter
My goal is to create a m4 macro, that reads a value from a file (`BUILD`), increases it and then saves the output into the file. I came up with the following solution (`BUILD.m4`): ```m4 define(`__buildnumber__',`esyscmd(cat BUILD)')dnl define(`counter',__buildnumber__)dnl popdef(__buildnumber__)dnl...
My goal is to create a m4 macro, that reads a value from a file (BUILD), increases it and then saves the output into the file. I came up with the following solution (BUILD.m4):
define(__buildnumber__',esyscmd(cat BUILD)')dnl
define(`counter',__buildnumber__)dnl
popdef(__buildnumber__)dnl
define(count',define(`counter',eval(counter+1))counter')dnl
count dnl
When BUILD contains 3 then running m4 BUILD.m4 outputs 4. Which is great! However, when I call it like this m4 BUILD.m4 > BUILD the BUILD file always contains 1. If I pipe to another file m4 BUILD.m4 > B it works and the B file will contain 4 when BUILD was 3. I suspect it has to do with the > output redirection. When comparing both variants with debug tracing it seems like the one with the redirection into the same file can not read from the file anymore. Variant redirection to different file:
% m4 -dtaeq BUILD.m4 > B
m4trace: -1- define(__buildnumber__', esyscmd(`cat BUILD')')
m4trace: -1- dnl
m4trace: -2- __buildnumber__ -> esyscmd(cat BUILD')'
m4trace: -2- esyscmd(cat BUILD') -> 3'
m4trace: -1- define(counter', 3')
Variant redirection to same file:
% m4 -dtaeq BUILD.m4 > BUILD
m4trace: -1- define(__buildnumber__', esyscmd(`cat BUILD')')
m4trace: -1- dnl
m4trace: -2- __buildnumber__ -> esyscmd(cat BUILD')'
m4trace: -2- esyscmd(`cat BUILD')
m4trace: -1- define(counter', ')
Is there a way of doing it like this, or do I need to use some other means of capturing the output
bckmnn (23 rep)
Oct 7, 2022, 11:21 AM • Last activity: Oct 7, 2022, 02:38 PM
1 votes
1 answers
999 views
How do I search for a string and then insert a newline at the beginning, for all lines in file?
I want to search an entire file for the string `---` when it appears at the beginning of a line. I then want to insert a newline before each instance of that string. In my `.vimrc` file, I added this command: let @p=":1,$s/^---/^M---/" When I execute it, it does not insert the newline character. Ins...
I want to search an entire file for the string --- when it appears at the beginning of a line. I then want to insert a newline before each instance of that string. In my .vimrc file, I added this command: let @p=":1,$s/^---/^M---/" When I execute it, it does not insert the newline character. Instead it ignores everything from the ^M on, so it replaces the --- with a null string, removing the 3 dashes from each line that contains them at the beginning. What is wrong with my @p command? I doesn't seem to recognize the ^M character. Is this not allowed in a search and replace command? I can do this manually, by the way, by simply typing the exact same command at the : prompt at the bottom of the file. I also tried: let @p=":1,$s/^---/^M^[---/" (added an escape after the newline) - this gave me the exact same result. Looks like it's ignoring the escape along with the rest of the replace section. Can someone tell me the correct way to do this? I do want to keep these commands in the vimrc file, because I edit a lot of files that have the same set of commands (and involve several macros, all of which work fine except this one), so I don't want to recreate the same macros every time I open a new file. Thank you!
Bastette (11 rep)
Aug 16, 2022, 07:20 AM • Last activity: Aug 16, 2022, 12:46 PM
1 votes
2 answers
448 views
m4 macro implementation of global (non-volatile) counter
Is it possible to define a m4 macro (without arguments), which expands to 1 on first invocation, expands to 2 on second invocation, and so on? In other words, it should have internal memory storing the number of times it is invoked. Can this be done?
Is it possible to define a m4 macro (without arguments), which expands to 1 on first invocation, expands to 2 on second invocation, and so on? In other words, it should have internal memory storing the number of times it is invoked. Can this be done?
adgadg (69 rep)
May 2, 2016, 08:49 AM • Last activity: Jan 31, 2022, 02:37 PM
0 votes
0 answers
356 views
How do I make an emoji macro keyboard for linux?
I want to make a macro keyboard that types emoji for my Raspberry Pi 4 with a quite old spare keyboard. I got this idea from Tom Scott (British youtuber) and he made it in windows. Although I could just find bare minimum info for how you can make it in Linux but I got some info about autohotkey and...
I want to make a macro keyboard that types emoji for my Raspberry Pi 4 with a quite old spare keyboard. I got this idea from Tom Scott (British youtuber) and he made it in windows. Although I could just find bare minimum info for how you can make it in Linux but I got some info about autohotkey and Luamacros but none of them work on Linux!! So if any of you could kindly provide me info about any other alternatives of the above programs that can run on Linux and provide the same result and take up maximum 20mb of space and how I can program my keyboard to get it to type emojis on Linux (in my case Raspbian) I tried nothing over here just because I want to do it in one take.
NHbinaaa111 (1 rep)
Oct 6, 2021, 10:10 AM • Last activity: Oct 6, 2021, 10:24 AM
1 votes
1 answers
1155 views
Which RPM Spec Macro provides OS Minor in Release, eg el8_4?
How do I get the OS Minor in the Release field of the RPMs? I understand that the spec file entry %{?dist} expands to the OS Major ``` Name: mypkg Version: 2.3 Release: 1.2%{?dist} Arch: noarch ``` and so the package is ``` mypkg-2.3-1.2.el8.noarch ``` Which marco could I use so it also provides the...
How do I get the OS Minor in the Release field of the RPMs? I understand that the spec file entry %{?dist} expands to the OS Major
Name:     mypkg
    Version:  2.3
    Release:  1.2%{?dist}
    Arch:     noarch
and so the package is
mypkg-2.3-1.2.el8.noarch
Which marco could I use so it also provides the OS Minor, eg
mypkg-2.3-1.2.el8_4.noarch
thanks
Amitava (11 rep)
Sep 14, 2021, 05:29 PM • Last activity: Sep 15, 2021, 12:37 PM
1 votes
1 answers
31 views
LibreOffice Upgrade from 3.5.4 to 4.3.3 Broke Lots of Macros
Recently upgraded from **Debian Wheezy** to **Jessie** (yeah, I know...). During said upgrade, the **LibreOffice** suite got upgraded from version **3.5.4** to **4.3.3**. Well, lots of my Writer macros were broken after said upgrade. Is anyone aware of any issues that could have caused this as a res...
Recently upgraded from **Debian Wheezy** to **Jessie** (yeah, I know...). During said upgrade, the **LibreOffice** suite got upgraded from version **3.5.4** to **4.3.3**. Well, lots of my Writer macros were broken after said upgrade. Is anyone aware of any issues that could have caused this as a result of said upgrade?
Digger (407 rep)
Aug 11, 2021, 11:45 PM
23 votes
5 answers
28933 views
Keyboard Shortcut To Send Text Strings To Program
How can I configure a shortcut key to send a text string to the current program? The purpose is to type common entries quicker (email address, street address, phone number, username, favorite quote, etc). I don't need any further automation than just entering the text. Gentoo Linux (3.2.12-gentoo) X...
How can I configure a shortcut key to send a text string to the current program? The purpose is to type common entries quicker (email address, street address, phone number, username, favorite quote, etc). I don't need any further automation than just entering the text. Gentoo Linux (3.2.12-gentoo) Xfce Desktop Environment (Version 4.8)
Steven (768 rep)
Apr 20, 2012, 01:49 AM • Last activity: Mar 4, 2021, 03:15 PM
0 votes
2 answers
634 views
Calling macdef macro within the .netrc file
I get this error: > Unknown .netrc keyword $download The script reads: machine **.gov login anonymous password none macdef download cd some directory quit $ download
I get this error: > Unknown .netrc keyword $download The script reads: machine **.gov login anonymous password none macdef download cd some directory quit $ download
Barry (1 rep)
Feb 11, 2021, 12:50 PM • Last activity: Feb 11, 2021, 05:25 PM
0 votes
1 answers
205 views
How can you customise headings in the ms package for groff?
I noticed there's a similar [answered][1] question here, but that one's pertaining to the me package. I'd like to know if and how, if so, is it possible to that using ms instead. [1]: https://unix.stackexchange.com/questions/504645/groff-me-macro-but-use-sans-serif-font-for-headings-etc
I noticed there's a similar answered question here, but that one's pertaining to the me package. I'd like to know if and how, if so, is it possible to that using ms instead.
Jamie Ramone (43 rep)
Dec 29, 2020, 12:55 PM • Last activity: Dec 30, 2020, 09:18 PM
0 votes
0 answers
58 views
press the button continuously doesn't work after running macro with cnee
When I play a recorded macro with `cnee`, pressing a key continuously doesn't work anymore until the next system start. Is this a known problem?
When I play a recorded macro with cnee, pressing a key continuously doesn't work anymore until the next system start. Is this a known problem?
o. kahn (21 rep)
May 10, 2020, 10:25 AM • Last activity: May 10, 2020, 11:16 AM
1 votes
1 answers
1078 views
RPM Spec file %setup macro when you don't know the root name?
How do I use the %setup macro if I don't know the root name of the archive. For example, in my case I have `archive.tar.gz` that extracts to myproject- / Each time I run that I may get a different `gitsha`. How can I configure that to work with a `.spec` file using `%setup`? Version looks like this,...
How do I use the %setup macro if I don't know the root name of the archive. For example, in my case I have archive.tar.gz that extracts to myproject-/ Each time I run that I may get a different gitsha. How can I configure that to work with a .spec file using %setup? Version looks like this, Version: 1.11 What I want is something like --strip 1 from tar.
Evan Carroll (34663 rep)
Apr 2, 2020, 07:57 AM • Last activity: Apr 2, 2020, 01:30 PM
3 votes
1 answers
2432 views
How can I find where an RPM macro is defined or what it expands to?
Inside of an RPM I have %{__install} %{SOURCE2} %{buildroot} I believe that `%{__install}` is a macro. Where do I find where it is defined? What is the definition? Was it provided by the system or distro, or is it a core rpm thing?
Inside of an RPM I have %{__install} %{SOURCE2} %{buildroot} I believe that %{__install} is a macro. Where do I find where it is defined? What is the definition? Was it provided by the system or distro, or is it a core rpm thing?
Evan Carroll (34663 rep)
Nov 19, 2019, 11:48 PM • Last activity: Nov 20, 2019, 04:27 AM
3 votes
1 answers
1834 views
mutt: ask for confirmation before moving message to archive
I have following macro defined in my `muttrc`: macro index s ":set confirmappend=no delete=yes auto_tag=yes\n\ =archive\n :set delete=ask-yes\n" When I press `s` on a message, it will immediately be moved into my `archive` folder. I would like to modify my macro, so that I will be asked for confirma...
I have following macro defined in my muttrc: macro index s ":set confirmappend=no delete=yes auto_tag=yes\n\ =archive\n:set delete=ask-yes\n" When I press s on a message, it will immediately be moved into my archive folder. I would like to modify my macro, so that I will be asked for confirmation before the message is moved. But when I change confirmappend=yes: macro index s ":set confirmappend=yes delete=yes auto_tag=yes\n\ =archive\n:set delete=ask-yes\n" and when I press s, mutt becomes immediately unresponsive, all keys stop working, I cannot even exit. The cpu runs at 100% and I have to log in from another console to kill mutt. Can somebody please advise how to correctly modify my macro?
Martin Vegter (598 rep)
Jun 13, 2014, 10:33 PM • Last activity: Nov 19, 2019, 02:00 PM
Showing page 1 of 20 total questions